summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.blaudden>2007-02-28 10:37:32 +0100
committerunknown <msvensson@pilot.blaudden>2007-02-28 10:37:32 +0100
commite40bcac08ed55c122b05bdbd04c273a665bea3b2 (patch)
treefa48919f369b4690037885006c81f455e9d6437e /mysql-test/lib
parent64278d4fc9020d9715867b7b2ef43aa67478b128 (diff)
downloadmariadb-git-e40bcac08ed55c122b05bdbd04c273a665bea3b2.tar.gz
Bug#26686 mysql-test-run.pl aborts when waitpid returns -1
- Add error handling for waitpid returns -1 for "simple run of command" mysql-test/lib/mtr_process.pl: - Add error handling for waitpid returns -1 when a simple command is run. - Add missing return - Add mtr_errors where the program should never come - Remove an else to improve program readability - Change mtr_debug to mtr_warning for "Got EAGAIN from fork()..."
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/mtr_process.pl29
1 files changed, 20 insertions, 9 deletions
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 9cf013d4e9d..20dca4b6980 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -125,19 +125,18 @@ sub spawn_impl ($$$$$$$$) {
{
if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
{
- mtr_debug("Got EAGAIN from fork(), sleep 1 second and redo");
+ mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
sleep(1);
redo FORK;
}
- else
- {
- mtr_error("$path ($pid) can't be forked");
- }
+
+ mtr_error("$path ($pid) can't be forked, error: $!");
+
}
if ( $pid )
{
- spawn_parent_impl($pid,$mode,$path);
+ return spawn_parent_impl($pid,$mode,$path);
}
else
{
@@ -202,8 +201,11 @@ sub spawn_impl ($$$$$$$$) {
{
mtr_child_error("failed to execute \"$path\": $!");
}
+ mtr_error("Should never come here 1!");
}
+ mtr_error("Should never come here 2!");
}
+ mtr_error("Should never come here 3!");
}
@@ -216,12 +218,21 @@ sub spawn_parent_impl {
{
if ( $mode eq 'run' )
{
- # Simple run of command, we wait for it to return
+ # Simple run of command, wait blocking for it to return
my $ret_pid= waitpid($pid,0);
if ( $ret_pid != $pid )
{
- mtr_error("waitpid($pid, 0) returned $ret_pid " .
- "when waiting for '$path'");
+ # The "simple" waitpid has failed, print debug info
+ # and try to handle the error
+ mtr_warning("waitpid($pid, 0) returned $ret_pid " .
+ "when waiting for '$path', error: '$!'");
+ if ( $ret_pid == -1 )
+ {
+ # waitpid returned -1, that would indicate the process
+ # no longer exist and waitpid couldn't wait for it.
+ return 1;
+ }
+ mtr_error("Error handling failed");
}
return mtr_process_exit_status($?);