Hi, Marc Lehmann. First.
1. I create object AnyEvent::DNS: my $resolver = AnyEvent::DNS->new() 2. Resolve some hosts. 2. Fetch some urls asynchronously if it's host has been resolved. 3. remove AnyEvent::DNS object: undef $resolver; 4. I create new object AnyEvent::DNS. Resolve some host. And get problem: some old watchers rise and run old callback function in new environment. Old watchers wasn't removed after "undef $resolver;" and continue working. Why? Timeout dosn't work correctly in AnyEvent::DNS I think. It dosn't remove watchers. #! /usr/bin/perl use strict; use warnings; use AnyEvent::DNS; my $resolver = AnyEvent::DNS->new(timeout => [2], server => [AnyEvent::Socket::parse_address('127.0.0.201')]); my $cv = AnyEvent->condvar(); my $resolve_sub = sub { warn "mindmix.ru resolved\n"; }; $resolver->resolve('mindmix.ru', 'a', accept => ["a"], $resolve_sub); my $timer = AnyEvent->timer( after => 1, cb => sub { warn "timeout for mindmix.ru\n"; $cv->send(); } ); $cv->recv(); undef $timer; undef $resolver; # here all watchers have to remove undef $resolve_sub; undef $cv; $resolver = AnyEvent::DNS->new(timeout => [2], server => [AnyEvent::Socket::parse_address('127.0.0.201')]); $cv = AnyEvent->condvar(); my $resolve_sub2 = sub { warn "beon.ru resolved\n"; }; $resolver->resolve('google.com', 'a', accept => ["a"], $resolve_sub2); $timer = AnyEvent->timer( after => 3, cb => sub { warn "timeout for beon.ru\n"; $cv->send(); } ); $cv->recv(); timeout for mindmix.ru mindmix.ru resolved beon.ru resolved timeout for beon.ru Why "mindmix.ru resolved" appear after "undef $resolver;" ? Second. Also some memory leaks found. Just add use Devel::Leak::Object qw(GLOBAL_bless); and run script: Tracked objects by class: AnyEvent::DNS 1 Config 1 Errno 1 -- Michael _______________________________________________ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev