Skip Menu |
 

This queue is for tickets about the IO-Socket-SSL CPAN distribution.

Report information
The Basics
Id: 73146
Status: resolved
Priority: 0/
Queue: IO-Socket-SSL

People
Owner: Nobody in particular
Requestors: CLEACH [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: memleak_bad_hanshake.t is in an infinite loop
Download (untitled) / with headers
text/plain 593b
Hello, You need to fix some serious bugs in the t/memleak_bad_handshake.t test case that can cause infinite loops in the test case! 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 had to put "system('echo $msg >> log.txt')" commands to a trace file to verify that I hit one of those exceptions, and thus proving it was a bug in the test case rather than my build! Curtis
Download (untitled) / with headers
text/plain 901b
Hi Curtis, unfortunatly I fail to understand your bug report: Show quoted text
> 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
Download (untitled) / with headers
text/plain 2.4k
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
Download (untitled) / with headers
text/plain 750b
Am So 11. Dez 2011, 15:07:24, CLEACH schrieb: Show quoted text
> 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. now I think I see what you mean. Maybe we have mixed understandings of the words parent and child. For me the parent is the process which invokes fork. Fork then returns 0 in the child process (which does the accept loop) but returns the pid of the child in the parent process. Your bug report probably means, that in case the test fails then the parent fails to kill the child, so that the child continues to run (waiting in accept for a connect). Fixed in 1.53.
fixed in 1.53


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.