diff options
author | Brion Vibber <brion@pobox.com> | 2010-02-16 09:22:02 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-02-16 09:22:02 -0800 |
commit | 81b6b58e33f55054b7e5dd546f06dbdb5696ed92 (patch) | |
tree | 7dddea4daac884f70d021fb11f1d02d560c0cd10 /lib/spawningdaemon.php | |
parent | 2e258454f396af9f95092b9564eee08179ff6be1 (diff) | |
parent | c74aea589d5a79d7048470d44e457dffc8919ad3 (diff) |
Merge branch 'master' into testing
Conflicts:
lib/stompqueuemanager.php
Diffstat (limited to 'lib/spawningdaemon.php')
-rw-r--r-- | lib/spawningdaemon.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/spawningdaemon.php b/lib/spawningdaemon.php index 862cbb4fa..fd9ae4355 100644 --- a/lib/spawningdaemon.php +++ b/lib/spawningdaemon.php @@ -90,18 +90,24 @@ abstract class SpawningDaemon extends Daemon while (count($children) > 0) { $status = null; $pid = pcntl_wait($status); - if ($pid > 0 && pcntl_wifexited($status)) { - $exitCode = pcntl_wexitstatus($status); - + if ($pid > 0) { $i = array_search($pid, $children); if ($i === false) { - $this->log(LOG_ERR, "Unrecognized child pid $pid exited with status $exitCode"); + $this->log(LOG_ERR, "Ignoring exit of unrecognized child pid $pid"); continue; } + if (pcntl_wifexited($status)) { + $exitCode = pcntl_wexitstatus($status); + $info = "status $exitCode"; + } else if (pcntl_wifsignaled($status)) { + $exitCode = self::EXIT_ERR; + $signal = pcntl_wtermsig($status); + $info = "signal $signal"; + } unset($children[$i]); if ($this->shouldRespawn($exitCode)) { - $this->log(LOG_INFO, "Thread $i pid $pid exited with status $exitCode; respawing."); + $this->log(LOG_INFO, "Thread $i pid $pid exited with $info; respawing."); $pid = pcntl_fork(); if ($pid < 0) { |