So what happens here, is that eventually reply_handle is called, which calls
reply_schedule_callback(req, ttl, 0, reply); in evdns.c:872 and then request_finished(req, &REQ_HEAD(req->base, req->trans_id), 1); in evdns.c:876 which calls mm_free(req->handle) When I call cancel I pass this freed handle to evdns_cancel_request and that causes crash. So the problem here is that the evdns_request structure is freed before the user's callback is called and there's no way for the client code to know when it's OK to cancel the request. I might be missing something, but why go through reply_schedule_callback at all? Why not call the user's callback immediately and avoid extra step which makes cancel() unsafe? On Wed, Nov 3, 2010 at 12:47 PM, Denis Bilenko <denis.bile...@gmail.com> wrote: > I've been working on making gevent use libevent's getaddrinfo and > occasionally get the above message in one of the test cases. What > could trigger it? How can I avoid it? > > I don't call evdns_getaddrinfo_cancel if the callback was already > executed, so I wonder how could I arrive at invalid request? > > libevent version: 2.0.8-rc > > A bit more context: > > #0 0x002cc422 in __kernel_vsyscall () > No symbol table info available. > #1 0x0013a651 in raise () from /lib/tls/i686/cmov/libc.so.6 > No symbol table info available. > #2 0x0013da82 in abort () from /lib/tls/i686/cmov/libc.so.6 > No symbol table info available. > #3 0x00329385 in event_exit (errcode=-559030611) at > /home/denis/src/libevent-all/libevent-2.0.8-rc/log.c:79 > No locals. > #4 0x003293b7 in event_errx (eval=-559030611, fmt=0x3402f4 "%s:%d: > Assertion %s failed in %s") at > /home/denis/src/libevent-all/libevent-2.0.8-rc/log.c:136 > No locals. > #5 0x00334468 in evdns_cancel_request (base=0x8cac928, > handle=0x8cb9530) at > /home/denis/src/libevent-all/libevent-2.0.8-rc/evdns.c:2672 > req = 0x267410 > __func__ = "evdns_cancel_request" > #6 0x003344a6 in evdns_getaddrinfo_cancel (data=0x8d0e588) at > /home/denis/src/libevent-all/libevent-2.0.8-rc/evdns.c:4465 > No locals. > #7 0x002e7773 in __pyx_pf_6gevent_4core_19getaddrinfo_request__cancel > (__pyx_v_self=<gevent.core.getaddrinfo_request at remote 0x8c74aec>, > unused=0x0) > at gevent/core.c:5227 > *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.