[getdns-api] Segmentation fault under load
Robert Groenenberg
robert.groenenberg at broadforward.com
Thu Sep 8 15:13:41 CEST 2016
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?
Thanks,
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://getdnsapi.net/pipermail/spec/attachments/20160908/38b3535a/attachment.html>
More information about the spec
mailing list