[getdns-api] Segmentation fault under load
Willem Toorop
willem at nlnetlabs.nl
Thu Sep 8 13:39:03 UTC 2016
Op 08-09-16 om 15:13 schreef Robert Groenenberg:
> Hi,
>
> Running an application that sends out ENUM queries using getdns
> (v1.0.0b2) and libevent2 on CentOS 6, runs fine for a low amount of
> requests.
> However, when sending ~50 requests per second, a segmenation fault
> occurs in _getdns_rbtree_insert() (some runs the Segv occurs in the
> compare function), after a few minutes.
>
>> Program terminated with signal 11, Segmentation fault.
>> #0 _getdns_rbtree_insert (rbtree=0x104a518, data=0x7f80f8004cc0) at
>> util/rbtree.c:240
>> 240 if ((r = rbtree->cmp(data->key, node->key)) == 0) {
>
>> #0 _getdns_rbtree_insert (rbtree=0x104a518, data=0x7f80f8004cc0) at
>> util/rbtree.c:240
>> #1 0x00007f80cc1dc0ef in _getdns_context_track_outbound_request
>> (dnsreq=0x7f80f8004cc0)
>> at ./context.c:3080
>> #2 0x00007f80cc1c9fed in getdns_general_ns (context=0x10493e0,
>> loop=0x1024940,
>> name=<value optimized out>, request_type=35, extensions=<value
>> optimized out>,
>> userarg=0x7f80f8006b50, return_netreq_p=0x7f809c5cbb88,
>> callbackfn=0x7f80cc44f7d0 <enum_lclient_callback>, internal_cb=0,
>> usenamespaces=0)
>> at ./general.c:452
>> #3 0x00007f80cc1ca3f1 in _getdns_general_loop (context=<value
>> optimized out>,
>> loop=<value optimized out>, name=<value optimized out>,
>> request_type=<value optimized out>,
>> extensions=<value optimized out>, userarg=<value optimized out>,
>> netreq_p=0x7f809c5cbb88,
>> callback=0x7f80cc44f7d0 <enum_lclient_callback>, internal_cb=0) at
>> ./general.c:517
>> #4 0x00007f80cc1ca454 in getdns_general (context=<value optimized out>,
>> name=<value optimized out>, request_type=<value optimized out>,
>> extensions=<value optimized out>, userarg=<value optimized out>,
>> transaction_id=0x7f80f8006b78, callbackfn=0x7f80cc44f7d0
>> <enum_lclient_callback>)
>> at ./general.c:674
>
> I suspect this to be a threading issue: the rbtree being accessed for
> both insert and delete from different threads. The call to
> /getdns_general//()/ is protected by a mutex in my application, so only
> one thread issues a query at a time. However, the event base runs in its
> own thread, as usual with libevent, so the problem probably lies in
> entries being deleted from the rbtree when the response is handled.
>
> Is it supposed to be possible with getdns to run the event base in its
> own thread?
No getdns does not anticipate this modus operandi (as you found out
yourself already). Running and scheduling should be done from the same
thread.
-- Willem
>
> Thanks,
> Robert
>
>
> _______________________________________________
> spec mailing list
> spec at getdnsapi.net
>
More information about the Users
mailing list