1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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,12 +661,14 @@ 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'
else { mtr_report("Child ${pid} was automatically reaped (this should never happend)");
delete $children{$ret_pid}; } elsif ($ret_pid != $pid) {
confess("Unexpected PID ${ret_pid} instead of expected ${pid}");
} }
delete $children{$ret_pid};
} }
} }