Safe Signals
This wasted a significant amount of my time today:
I fixed by adding a label FOO: in front of the while loop, and putting a goto FOO below it. Good enough for me.
$SIG{CHLD} = sub { 1 };Now, one would think that the while loop should just merrily continue along from child to child, but instead -- apparently because of a problem in IO::Socket itself, resulting from the new safe signals in perl 5.8.0 -- the SIGCHLD is improperly interpreted as a SIGALRM and the while loop ends.
my $sock = new IO::Socket::INET (
LocalPort => 2305,
Type => SOCK_STREAM,
Proto => 'tcp',
Reuse => 1,
Listen => 10,
) or die "Could not start server: $!.\n";
while (my $child = $sock->accept) {
next if fork;
exit;
}
print "huh?";
I fixed by adding a label FOO: in front of the while loop, and putting a goto FOO below it. Good enough for me.
Leave a comment