1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-25802 mtr: race condition if the test quickly restarts twice

part II

need to tell SafeProcess not to collect the exited mysqld
in sleep_until_file_created(), so that it would be found in the
later wait_any_timeout() in run_testcase()

Removed a strange condition in SafeProcess::wait_one()
that treated return value of -1 from waitpid() as "process exists"
instead of as "no such child process" (see `perldoc -f waitpid`)
This commit is contained in:
Sergei Golubchik
2021-07-06 11:36:59 +02:00
parent 1223cfe1d3
commit 621fae3cbc
2 changed files with 10 additions and 10 deletions

View File

@ -395,10 +395,10 @@ sub _collect {
# 1 Still running
#
sub wait_one {
my ($self, $timeout)= @_;
croak "usage: \$safe_proc->wait_one([timeout])" unless ref $self;
my ($self, $timeout, $keep)= @_;
croak "usage: \$safe_proc->wait_one([timeout] [, keep])" unless ref $self;
_verbose("wait_one $self, $timeout");
_verbose("wait_one $self, $timeout, $keep");
if ( ! defined($self->{SAFE_PID}) ) {
# No pid => not running
@ -472,16 +472,16 @@ sub wait_one {
return 1;
}
if ( not $blocking and $retpid == -1 ) {
# still running
_verbose("still running");
return 1;
}
#if ( not $blocking and $retpid == -1 ) {
# # still running
# _verbose("still running");
# return 1;
#}
#warn "wait_one: expected pid $pid but got $retpid"
# unless( $retpid == $pid );
$self->_collect($exit_code);
$self->_collect($exit_code) unless $keep;
return 0;
}