@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Manage PIDs more carefully in DaemonHandle

Summary:
Ref T13555. Although these callsites may not actually impact anything, it's possible for an active handle to have no PID (e.g., if the subprocess failed to start).

Handle these cases more carefully.

Test Plan: Started daemons, saw them run fine. See also next change.

Maniphest Tasks: T13555

Differential Revision: https://secure.phabricator.com/D21424

+16 -9
+16 -9
src/infrastructure/daemon/PhutilDaemonHandle.php
··· 327 327 328 328 private function annihilateProcessGroup() { 329 329 $pid = $this->getPID(); 330 - 331 - $pgid = posix_getpgid($pid); 332 - if ($pid && $pgid) { 333 - posix_kill(-$pgid, SIGTERM); 334 - sleep($this->getKillDelay()); 335 - posix_kill(-$pgid, SIGKILL); 336 - $this->pid = null; 330 + if ($pid) { 331 + $pgid = posix_getpgid($pid); 332 + if ($pgid) { 333 + posix_kill(-$pgid, SIGTERM); 334 + sleep($this->getKillDelay()); 335 + posix_kill(-$pgid, SIGKILL); 336 + $this->pid = null; 337 + } 337 338 } 338 339 } 339 340 ··· 440 441 // naturally be restarted after it exits, as though it had exited after an 441 442 // unhandled exception. 442 443 443 - posix_kill($this->getPID(), SIGINT); 444 + $pid = $this->getPID(); 445 + if ($pid) { 446 + posix_kill($pid, SIGINT); 447 + } 444 448 } 445 449 446 450 public function didReceiveGracefulSignal($signo) { ··· 461 465 462 466 $this->logMessage('DONE', $sigmsg, $signo); 463 467 464 - posix_kill($this->getPID(), SIGINT); 468 + $pid = $this->getPID(); 469 + if ($pid) { 470 + posix_kill($pid, SIGINT); 471 + } 465 472 } 466 473 467 474 public function didReceiveTerminateSignal($signo) {