Replying to myself and letting the list to know of the progress, I found the answer to question 1.
Yes, libevent-2.0.1-alpha is thread-safe with respect to DNS resolution while libevent-1.4.11-stable is not. So, obviously, question 2. is also true. The old library 'libdnsres' is really obsolete and it should be used only as a reference. Please forgot point 3. which has been resolved with the adoption of the evdns_base_resolve_reverse() available in 2.0.1-alpha instead of the evdns_resolve_reverse() in 1.4.11-stable. regards /rocco On 29 June 22:51 2009 Rocco Carbone spoke: | hi list, | while experimenting asynchronous PTR resolution I had some issues | with latest {stable, alpha} libevent releases. | | So I am looking for a gentle soul out of here in order to answer | few questions: | | 1. are the latest libevent releases (both 1.4.11-stable and 2.0.1-alpha) | thread-safe with respect to the DNS resolution? | | 2. is the libdnsres-0.1a available at http://www.monkey.org/~provos/libdnsres-0.1a.tar.gz | made obsolete by the latest libevent? | | 3. I wrote some example programs performing PTR resolution that perfectly work | as single-process but they randomly crash in a multi-threads | environment. | | Could someone take a look and is so gentle to give me a hint? | | Basically the multi-thread version | 1. fire up 't' threads (default 5) in order to globally resolve 'n' (default 30) PTR records | a. each thread define a heartbeat callback (shared among all threads) | and randomly set the time interval at microseconds resolution | b. generate a random numeric IP address | c. ask to resolv the numeric IP address | | but it still crashes (same with 1.4.11-stable and 2.0.1-alpha) and gdb gives me: | | Program received signal SIGSEGV, Segmentation fault. | [Switching to Thread 0xb65eeb90 (LWP 12309)] | 0x0804c62e in evdns_request_transmit (req=0x93d6158) at evdns.c:1923 | 1923 if (req->ns->choked) { | (gdb) p req->ns | $1 = (struct nameserver *) 0x0 | | Why 'req->ns' should be modified from request to request? | | In a desperate effort to check my fault I also experimented the (old?) | libdnsres library, which is declared to be thread-safe. | | So I rewrote the same program in terms of dnsres_gethostbyaddr() | rather than evdns_resolve_reverse(). But also this version | crashes. | | Using libevent 1.4.11-stable I have: | ro...@tar 664> ./dnsmtptr | Benchmarking now for 30 PTR queries using 5 threads (please be patient)... | 50.22.143.95 unresolved in 0.190346 (3058973584 => 3050580880) | 96.114.67.46 unresolved in 0.152732 (3067366288 => 3050580880) | 42.124.244.35 unresolved in 0.189551 (3075758992 => 3050580880) | dnsmtptr: event.c:1271: event_del_internal: Assertion `!(ev->ev_flags & ~(0xf000 | 0x9f))' failed. | Abort | | While using libevent 2.0.1-alpha I have: | ro...@tar 665> ./dnsmtptr | Benchmarking now for 30 PTR queries using 5 threads (please be patient)... | 46.200.144.64 resolved to c934d133.virtua.com.br in 0.099072 | 238.17.171.225 unresolved in 0.070811 (made by 3083844496 - resolved by 3050273680) | 198.73.252.55 unresolved in 0.154002 (made by 3075451792 - resolved by 3050273680) | 133.128.41.39 unresolved in 0.046067 (made by 3058666384 - resolved by 3050273680) | 46.200.144.64 unresolved in 0.191388 | 198.73.252.55 unresolved in 0.306394 (made by 3075451792 - resolved by 3050273680) | 53.75.105.50 unresolved in 0.054406 (made by 3067059088 - resolved by 3050273680) | 22.123.10.191 unresolved in 0.190736 (made by 3075451792 - resolved by 3050273680) | 217.84.237.72 resolved to pD954ED48.dip0.t-ipconnect.de in 0.179229 (made by 3058666384 - resolved by 3050273680) | Segmentation fault | Program received signal SIGSEGV, Segmentation fault. | [Switching to Thread 0xb75b6b90 (LWP 15632)] | evmap_io_add (base=0x0, fd=5, ev=0x8215720) at evmap.c:258 | | | I include the complete tarball in the hope someone will be able to | find mine or framework errors. | | thanks a lot in advance | | /rocco |
evptr.tar.gz
Description: DNS resolution sources
-- Rocco Carbone mail-to: <rocco /at/ ntop /dot/ org> Pisa Italy Life is in the details In other words, you are welcome to use, share and improve me. You are forbidden to forbid anyone else to use, share and improve what I gave you.
_______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users