cleanup() may leave the AE::cv objects without recv() in connect_queue array resulting in hanging of the async code. Here is a simple code that will never finish:
#!/usr/bin/perl
use AnyEvent::Redis;
my $redis = AnyEvent::Redis->new(
port => 9999, # unallocated port
on_error => sub { warn @_ },
on_cleanup => sub { warn "Connection closed: @_" },
);
my $cv1 = $redis->get( 'foo1' );
my $cv2 = $redis->get( 'foo2' );
$cv2->recv;
will output:
Can't connect Redis server: Connection refused at ./connect_queue_bug.pl line 7.
Connection closed: Can't connect Redis server: Connection refused at ./connect_queue_bug.pl line 8.
and never finish.
With this patch:
Can't connect Redis server: Connection refused at ./connect_queue_bug.pl line 7.
Connection closed: Can't connect Redis server: Connection refused at ./connect_queue_bug.pl line 8.
Can't connect Redis server: Connection refused at ./connect_queue_bug.pl line 14.
Hi,
cleanup()
may leave theAE::cv
objects withoutrecv()
inconnect_queue
array resulting in hanging of the async code. Here is a simple code that will never finish:will output:
and never finish.
With this patch:
and terminate normally.
Best regards Jozef