Subject: | All of the IO::Socket socket tests are broken with respect to signal interrupts |
All of the IO::Socket socket tests are broken with respect to signal
interrupts. For instance, SIGCHLD, as seen in the attached test script.
At a minimum there needs to be a retry on the EINTR errno.
Subject: | lwp_eintr_test.pl |
#!/usr/bin/perl -w
use strict;
use warnings;
use LWP::UserAgent;
my $test_duration_seconds = 5;
$| = 1;
$SIG{CHLD} = sub { }; # comment out this line and the bug will not occur
my $start_test_time = time();
if (!fork()) {
while (time() < $start_test_time + $test_duration_seconds) {
if (!fork()) { exit 0; }
}
exit 0;
}
{
my $ua = new LWP::UserAgent;
my $iterations = 0;
while (time() < $start_test_time + $test_duration_seconds) {
sub callback($$$) { }
my $request = HTTP::Request->new('GET', 'http://www.perl.org/favicon.ico');
my $response = $ua->request($request, \&callback, 4096);
if ($response->is_error()) {
die("Couldn't get - returned ".$response->code()." ".$response->as_string()."\n");
}
$iterations++;
print('.');
}
die if $iterations < 1;
print("success ($iterations iterations)\n");
}
exit 0;