From: Lupe Christoph Date: Wed, 4 Sep 1996 02:54:41 +0000 (+0000) Subject: Perl 5.003.03: race condition in t/lib/io_sock.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=53326d4cb95b0a426abad58608c3cd209994a30e;p=p5sagit%2Fp5-mst-13.2.git Perl 5.003.03: race condition in t/lib/io_sock.t io_sock.t works by forking a subprocess it can communicate with. It has the subprocess wait for the main process by sleeping 10 seconds or until an alarm arrives. With my setup, the alarm signal arrives *before* the child has a chance to ignore the alarm signal. I fixed this by moving the "$SIG{ALRM} = sub {};" up before the fork. It does not hurt to have the parent ignore alarms, too. --- diff --git a/t/lib/io_sock.t b/t/lib/io_sock.t index e888c5e..53690b1 100755 --- a/t/lib/io_sock.t +++ b/t/lib/io_sock.t @@ -18,6 +18,7 @@ print "1..5\n"; use IO::Socket; $port = 4002 + int(rand(time) & 0xff); +$SIG{ALRM} = sub {}; $pid = fork(); @@ -51,7 +52,6 @@ if($pid) { # Wait for a small pause, so that we can ensure the listen socket is setup # the parent will awake us with a SIGALRM - $SIG{ALRM} = sub {}; sleep(10); $sock = IO::Socket::INET->new(PeerPort => $port,