Hi Steffen,
Your problem is with the "exit" calls below the code snippet you
provided. That code shows where the parent process terminates and it's
fine. The problem is with the child process code later on, not the parent.
Here's the patch I needed to do to fix the infinite loop! Without the
extra code added, the child process terminates on these unexpected
conditions, but doesn't tell the parent process that it's done. So the
child terminates & the parent process remains in an infinite loop
waiting on actions by a child process that no longer exists. (Or it
could be blocked by the accept() call, so either way the test just sits
there forever until the job is killed.)
I personally hit the 2nd case, but if you are going to fix one of them,
you should be fixing both of these cases.
Curtis
my $size100 = getsize($pid);
if ( ! $size100 ) {
print "1..0 # Skipped: cannot get size of child process\n";
# Added by me on 12/09/2011 to avoid infinite loop in parent!
kill(9,$pid);
wait;
exit
}
for(100..200) {
IO::Socket::INET->new( $addr ) or next;
}
my $size200 = getsize($pid);
for(200..300) {
IO::Socket::INET->new( $addr ) or next;
}
my $size300 = getsize($pid);
if ($size100>$size200 or $size200<$size300) {;
print "1..0 # skipped - do we measure the right thing?\n";
# Added by me on 12/09/2011 to avoid infinite loop in parent!
kill(9,$pid);
wait;
exit;
}
print "1..1\n";
On Sun Dec 11 14:50:43 2011, SULLR wrote:
Show quoted text> Hi Curtis,
> unfortunatly I fail to understand your bug report:
>
> > After the "close($server);" call you are always in the child process.
> > So every time you call "exit" without first calling "kill(9,$pid);
> > wait;" you leave the parent process in an infinite loop as the child
> > process terminates. This happens in 2 different places.
>
> I guess you refer to the following code:
>
> 45 if ( $pid == 0 ) {
> 46 # server
> 47 while (1) {
> 48 # socket accept, client handshake and client close
> 49 $server->accept;
> 50 }
> 51 exit
> 52 }
> 53
> 54 close($server);
>
> The close($server) should never be in the child process.
> The child is when the fork returns 0, so it is lines 45..52.
> In line 51 the child exits so it can not continue in line 54.
>
> If you still think that there is a bug I would ask you to give me more
> details so that I can understand the problem.
>
> Regards,
> Steffen