[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] evdns behaviour questions and suggestions



Hello. Using libevent (specifically evdns subsystem) I've encountered with some troubles.

1) How should I properly interrupt all pending evdns_getaddrinfo requests and free evdns_base? Let's say I've caught signal to interrupt working. If I call evdns_getaddrinfo_cancel for all pending evdns getaddrinfo requests and immediately call evdns_base_free(evdns_base, 0) and event_base_free(base) then some memory leaks occur. In my testing program I detect memory leaks using mtrace/muntrace. (If it's needed I can attach testing program). In one mtrace log I've got this:
=====
Memory not freed:
-----------------
           Address     Size     Caller
0x00000000006035e0     0x30  at 0x7ffff799224f
0x0000000000603620    0x108  at 0x7ffff7992687
0x0000000000603730    0x108  at 0x7ffff7992687
0x0000000000603840     0x30  at 0x7ffff799224f
0x0000000000603880     0x30  at 0x7ffff799238f
0x0000000000603d60     0x30  at 0x7ffff799224f
0x0000000000603e60     0x30  at 0x7ffff799238f
0x0000000000603ea0     0x30  at 0x7ffff799238f
0x0000000000603fc0     0x30  at 0x7ffff799238f
0x0000000000604010    0x108  at 0x7ffff7992687
0x0000000000604120     0x40  at 0x7ffff7bc7496
0x0000000000604170     0x40  at 0x7ffff7bc7496
0x00000000006043e0    0x258  at 0x7ffff798d553
0x0000000000604640    0x108  at 0x7ffff7992687
0x0000000000604900    0x258  at 0x7ffff798d553
0x0000000000604b60    0x258  at 0x7ffff798d553
0x0000000000604f20    0x258  at 0x7ffff798d553
0x0000000000605180    0x258  at 0x7ffff798d553
0x00000000006056a0    0x258  at 0x7ffff798d553
0x0000000000605900    0x258  at 0x7ffff798d553
=====
Then in gdb I've got which code they are:
=====
(gdb) info line *0x7ffff798d553
Line 834 of "libevent-2.1.5-beta/evdns.c" starts at address 0x7ffff798d553 <reply_schedule_callback+35>
   and ends at 0x7ffff798d556 <reply_schedule_callback+38>.
(gdb) info line *0x7ffff799224f
Line 2861 of "libevent-2.1.5-beta/evdns.c"
starts at address 0x7ffff799224f <evdns_base_resolve_ipv4+63> and ends at 0x7ffff7992252 <evdns_base_resolve_ipv4+66>.
(gdb) info line *0x7ffff799238f
Line 2900 of "libevent-2.1.5-beta/evdns.c"
starts at address 0x7ffff799238f <evdns_base_resolve_ipv6+63> and ends at 0x7ffff7992392 <evdns_base_resolve_ipv6+66>.
(gdb) info line *0x7ffff7992687
Line 4650 of "libevent-2.1.5-beta/evdns.c" starts at address 0x7ffff7992687 <evdns_getaddrinfo+551>
   and ends at 0x7ffff799268a <evdns_getaddrinfo+554>.
(gdb) info line *0x7ffff7bc7496
Line 824 of "libevent-2.1.5-beta/evutil.c" starts at address 0x7ffff7bc7496 <evutil_new_addrinfo_+70>
   and ends at 0x7ffff7bc7499 <evutil_new_addrinfo_+73>.
=====

2) It would be very useful in some cases if there was additional evdns functions similar to some event_* such as: event_base_foreach_event(), event_get_callback() and event_get_callback_arg().

3) If evdns_getaddrinfo_cancel is called then evdns_getaddrinfo_request callback will be called with result = EVUTIL_EAI_CANCEL (not DNS_ERR_CANCEL). Am I right? If yes it was not easy to figure out, in documentation it is not very clear.

***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.