1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-29023 waitpid() cleanup

The case for "Unknown process $ret_pid exited" is never known to be
valid. Such state is not documented for waitpid().
This commit is contained in:
Aleksey Midenkov
2022-07-18 23:16:18 +03:00
parent 1d307ed48a
commit 7ca5c7d8f9

View File

@@ -661,14 +661,16 @@ sub main {
foreach my $pid (keys %children) foreach my $pid (keys %children)
{ {
my $ret_pid= waitpid($pid, 0); my $ret_pid= waitpid($pid, 0);
if ($ret_pid != $pid){ if ($ret_pid == -1) {
mtr_report("Unknown process $ret_pid exited"); # Child was automatically reaped. Probably not possible
# unless you $SIG{CHLD}= 'IGNORE'
mtr_report("Child ${pid} was automatically reaped (this should never happend)");
} elsif ($ret_pid != $pid) {
confess("Unexpected PID ${ret_pid} instead of expected ${pid}");
} }
else {
delete $children{$ret_pid}; delete $children{$ret_pid};
} }
} }
}
if ( not @$completed ) { if ( not @$completed ) {
mtr_error("Test suite aborted"); mtr_error("Test suite aborted");