I found that the following example works as expected on perl 5.14 and above, but fails with perl 5.10 and 5.12:
use 5.010;
use strict;
use warnings;
use RedisDB 2.07;
my $pub = RedisDB->new;
my $sub = RedisDB->new;
$sub->subscribe('foo');
$sub->get_reply;
local $SIG{ALRM} = sub { $pub->publish( 'foo', 'bar' ); };
alarm 2;
$sub->get_reply;
On 5.10 I got the following error:
Error reading reply from server: at /home/zwon/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/RedisDB.pm line 443.
RedisDB::get_reply('RedisDB=HASH(0x24dd798)') called at /tmp/redis_recv_eintr.pl line 13
After a bit of experimenting I've found that in certain conditions recv if interrupted returns undef as expected, but sets $! to zero instead of EINTR. This appears to be fixed in 5.14.
I found that the following example works as expected on perl 5.14 and above, but fails with perl 5.10 and 5.12:
On 5.10 I got the following error:
After a bit of experimenting I've found that in certain conditions
recv
if interrupted returnsundef
as expected, but sets$!
to zero instead ofEINTR
. This appears to be fixed in 5.14.