tests: Fix zombie processes left behind by FTP tests.
ftpserver.pl correctly cleans up spawned server processes, but forgets to wait for the shell used to spawn them. This is barely noticeable during a normal testrun, but causes process exhaustion and test failure during a complete torture run of the FTP tests. Fixes #12018 Closes #12020
This commit is contained in:
parent
d1b0317f9b
commit
f2ff730b38
@ -410,21 +410,22 @@ sub sysread_or_die {
|
||||
}
|
||||
|
||||
sub startsf {
|
||||
my $mainsockfcmd = "./server/sockfilt".exe_ext('SRV')." " .
|
||||
"--ipv$ipvnum --port $port " .
|
||||
"--pidfile \"$mainsockf_pidfile\" " .
|
||||
"--portfile \"$portfile\" " .
|
||||
"--logfile \"$mainsockf_logfile\"";
|
||||
$sfpid = open2(*SFREAD, *SFWRITE, $mainsockfcmd);
|
||||
my @mainsockfcmd = ("./server/sockfilt".exe_ext('SRV'),
|
||||
"--ipv$ipvnum",
|
||||
"--port", $port,
|
||||
"--pidfile", $mainsockf_pidfile,
|
||||
"--portfile", $portfile,
|
||||
"--logfile", $mainsockf_logfile);
|
||||
$sfpid = open2(*SFREAD, *SFWRITE, @mainsockfcmd);
|
||||
|
||||
print STDERR "$mainsockfcmd\n" if($verbose);
|
||||
print STDERR "@mainsockfcmd\n" if($verbose);
|
||||
|
||||
print SFWRITE "PING\n";
|
||||
my $pong;
|
||||
sysread_or_die(\*SFREAD, \$pong, 5);
|
||||
|
||||
if($pong !~ /^PONG/) {
|
||||
logmsg "Failed sockfilt command: $mainsockfcmd\n";
|
||||
logmsg "Failed sockfilt command: @mainsockfcmd\n";
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose);
|
||||
unlink($pidfile);
|
||||
unlink($portfile);
|
||||
@ -2433,7 +2434,6 @@ sub STOR_ftp {
|
||||
sub PASV_ftp {
|
||||
my ($arg, $cmd)=@_;
|
||||
my $pasvport;
|
||||
my $bindonly = ($nodataconn) ? '--bindonly' : '';
|
||||
|
||||
# kill previous data connection sockfilt when alive
|
||||
if($datasockf_runs eq 'yes') {
|
||||
@ -2447,11 +2447,14 @@ sub PASV_ftp {
|
||||
logmsg "DATA sockfilt for passive data channel starting...\n";
|
||||
|
||||
# We fire up a new sockfilt to do the data transfer for us.
|
||||
my $datasockfcmd = "./server/sockfilt".exe_ext('SRV')." " .
|
||||
"--ipv$ipvnum $bindonly --port 0 " .
|
||||
"--pidfile \"$datasockf_pidfile\" " .
|
||||
"--logfile \"$datasockf_logfile\"";
|
||||
$slavepid = open2(\*DREAD, \*DWRITE, $datasockfcmd);
|
||||
my @datasockfcmd = ("./server/sockfilt".exe_ext('SRV'),
|
||||
"--ipv$ipvnum", "--port", 0,
|
||||
"--pidfile", $datasockf_pidfile,
|
||||
"--logfile", $datasockf_logfile);
|
||||
if($nodataconn) {
|
||||
push(@datasockfcmd, '--bindonly');
|
||||
}
|
||||
$slavepid = open2(\*DREAD, \*DWRITE, @datasockfcmd);
|
||||
|
||||
if($nodataconn) {
|
||||
datasockf_state('PASSIVE_NODATACONN');
|
||||
@ -2460,7 +2463,7 @@ sub PASV_ftp {
|
||||
datasockf_state('PASSIVE');
|
||||
}
|
||||
|
||||
print STDERR "$datasockfcmd\n" if($verbose);
|
||||
print STDERR "@datasockfcmd\n" if($verbose);
|
||||
|
||||
print DWRITE "PING\n";
|
||||
my $pong;
|
||||
@ -2666,15 +2669,15 @@ sub PORT_ftp {
|
||||
logmsg "DATA sockfilt for active data channel starting...\n";
|
||||
|
||||
# We fire up a new sockfilt to do the data transfer for us.
|
||||
my $datasockfcmd = "./server/sockfilt".exe_ext('SRV')." " .
|
||||
"--ipv$ipvnum --connect $port --addr \"$addr\" " .
|
||||
"--pidfile \"$datasockf_pidfile\" " .
|
||||
"--logfile \"$datasockf_logfile\"";
|
||||
$slavepid = open2(\*DREAD, \*DWRITE, $datasockfcmd);
|
||||
my @datasockfcmd = ("./server/sockfilt".exe_ext('SRV'),
|
||||
"--ipv$ipvnum", "--connect", $port, "--addr", $addr,
|
||||
"--pidfile", $datasockf_pidfile,
|
||||
"--logfile", $datasockf_logfile);
|
||||
$slavepid = open2(\*DREAD, \*DWRITE, @datasockfcmd);
|
||||
|
||||
datasockf_state('ACTIVE');
|
||||
|
||||
print STDERR "$datasockfcmd\n" if($verbose);
|
||||
print STDERR "@datasockfcmd\n" if($verbose);
|
||||
|
||||
print DWRITE "PING\n";
|
||||
my $pong;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user