fix #977 (redirection vers collection dans task archive)

fix #969 (arrêt de la task d'archivage)
fix #982 (symfony/process returnValue = -1)
This commit is contained in:
jygaulier
2012-10-30 15:08:45 +01:00
parent c3309dd2c2
commit 2a75b76f32
2 changed files with 20 additions and 8 deletions

View File

@@ -33,6 +33,7 @@ class task_Scheduler
public function __construct(Logger $logger)
{
declare(ticks = 1);
$this->logger = $logger;
}
@@ -52,6 +53,14 @@ class task_Scheduler
* @throws Exception if scheduler is already running
* @todo doc all possible exception
*/
public function sigHandler($signal)
{
$status = null;
$pid = pcntl_wait($status);
$exitstatus = pcntl_wexitstatus ( $status );
$this->log(sprintf("sigchild %s received from pid=%s, status=%s, exitstatus=%s\n", $signal, $pid, var_export($status, true), $exitstatus));
}
public function run()
{
@@ -73,7 +82,10 @@ class task_Scheduler
if (\task_manager::isPosixPcntlSupported()) {
// avoid <defunct> php when a task ends
pcntl_signal(SIGCHLD, SIG_IGN);
// pcntl_signal(SIGCHLD, SIG_IGN); // no zombies but no returnValue
// pcntl_signal(SIGCHLD, SIG_DFL); // with "declare(ticks=1)" returnValue ok but zombies
pcntl_signal(SIGCHLD, array($this, 'sigHandler')); // ok
$this->method = self::METHOD_FORK;
}