diff options
author | unknown <knielsen@mysql.com> | 2006-02-11 22:50:59 +0100 |
---|---|---|
committer | unknown <knielsen@mysql.com> | 2006-02-11 22:50:59 +0100 |
commit | 503193867ef8ee460b03ebfa9cb8e0409624c257 (patch) | |
tree | 14e69c96cf89aea5979c1d6ad101dd09f1fb678c /mysql-test/lib/mtr_process.pl | |
parent | db4d82bad49a5c1b69c4b3134ad9c2f25b9e3221 (diff) | |
download | mariadb-git-503193867ef8ee460b03ebfa9cb8e0409624c257.tar.gz |
Fix a race on some platforms in mysql-test-run.pl, where it would sometimes
errorneously abort reporting failure to kill child processes, where in
reality the problem was merely that the child had become a zombie because
of missing waitpid() call.
mysql-test/lib/mtr_process.pl:
Fix race (on some platforms) when killing processes.
Diffstat (limited to 'mysql-test/lib/mtr_process.pl')
-rw-r--r-- | mysql-test/lib/mtr_process.pl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 177665cf578..4da608ad345 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -770,7 +770,15 @@ sub mtr_record_dead_children () { } sub start_reap_all { - $SIG{CHLD}= 'IGNORE'; # FIXME is this enough? + # This causes terminating processes to not become zombies, avoiding + # the need for (or possibility of) explicit waitpid(). + $SIG{CHLD}= 'IGNORE'; + + # On some platforms (Linux, QNX, OSX, ...) there is potential race + # here. If a process terminated before setting $SIG{CHLD} (but after + # any attempt to waitpid() it), it will still be a zombie. So we + # have to handle any such process here. + while(waitpid(-1, &WNOHANG) > 0) { }; } sub stop_reap_all { |