diff --git a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php --- a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php +++ b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php @@ -536,6 +536,9 @@ 'differential.whitespace-matters' => pht( 'Whitespace rendering is now handled automatically.'), + + 'phd.pid-directory' => pht( + 'Phabricator daemons no longer use PID files.'), ); return $ancient_config; diff --git a/src/applications/config/option/PhabricatorPHDConfigOptions.php b/src/applications/config/option/PhabricatorPHDConfigOptions.php --- a/src/applications/config/option/PhabricatorPHDConfigOptions.php +++ b/src/applications/config/option/PhabricatorPHDConfigOptions.php @@ -21,10 +21,6 @@ public function getOptions() { return array( - $this->newOption('phd.pid-directory', 'string', '/var/tmp/phd/pid') - ->setLocked(true) - ->setDescription( - pht('Directory that phd should use to track running daemons.')), $this->newOption('phd.log-directory', 'string', '/var/tmp/phd/log') ->setLocked(true) ->setDescription( diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php @@ -12,11 +12,6 @@ ->selectSymbolsWithoutLoading(); } - final protected function getPIDDirectory() { - $path = PhabricatorEnv::getEnvConfig('phd.pid-directory'); - return $this->getControlDirectory($path); - } - final protected function getLogDirectory() { $path = PhabricatorEnv::getEnvConfig('phd.log-directory'); return $this->getControlDirectory($path); @@ -30,11 +25,10 @@ pht( "%s requires the directory '%s' to exist, but it does not exist ". "and could not be created. Create this directory or update ". - "'%s' / '%s' in your configuration to point to an existing ". + "'%s' in your configuration to point to an existing ". "directory.", 'phd', $path, - 'phd.pid-directory', 'phd.log-directory')); } } @@ -146,14 +140,6 @@ $config['log'] = $this->getLogDirectory().'/daemons.log'; } - $pid_dir = $this->getPIDDirectory(); - - // TODO: This should be a much better user experience. - Filesystem::assertExists($pid_dir); - Filesystem::assertIsDirectory($pid_dir); - Filesystem::assertWritable($pid_dir); - - $config['piddir'] = $pid_dir; $config['daemons'] = $daemons; $command = csprintf('./phd-daemon %Ls', $flags); diff --git a/src/infrastructure/daemon/control/PhabricatorDaemonReference.php b/src/infrastructure/daemon/control/PhabricatorDaemonReference.php --- a/src/infrastructure/daemon/control/PhabricatorDaemonReference.php +++ b/src/infrastructure/daemon/control/PhabricatorDaemonReference.php @@ -1,127 +1,9 @@ setViewer(PhabricatorUser::getOmnipotentUser()) - ->withDaemonIDs($daemon_ids) - ->execute(); - } catch (AphrontQueryException $ex) { - // Ignore any issues here; getting this information only allows us - // to provide a more complete picture of daemon status, and we want - // these commands to work if the database is inaccessible. - } - - $logs = mpull($logs, null, 'getDaemonID'); - } - - // Support PID files that use the old daemon format, where each overseer - // had exactly one daemon. We can eventually remove this; they will still - // be stopped by `phd stop --force` even if we don't identify them here. - if (!$daemons && idx($dict, 'name')) { - $daemons = array( - array( - 'config' => array( - 'class' => idx($dict, 'name'), - 'argv' => idx($dict, 'argv', array()), - ), - ), - ); - } - - foreach ($daemons as $daemon) { - $ref = new PhabricatorDaemonReference(); - - // NOTE: This is the overseer PID, not the actual daemon process PID. - // This is correct for checking status and sending signals (the only - // things we do with it), but might be confusing. $daemon['pid'] has - // the daemon PID, and we could expose that if we had some use for it. - - $ref->pid = idx($dict, 'pid'); - $ref->start = idx($dict, 'start'); - - $config = idx($daemon, 'config', array()); - $ref->name = idx($config, 'class'); - $ref->argv = idx($config, 'argv', array()); - - $log = idx($logs, idx($daemon, 'id')); - if ($log) { - $ref->daemonLog = $log; - } - - $ref->pidFile = $path; - $refs[] = $ref; - } - - return $refs; - } +// TODO: See T13321. After the removal of daemon PID files this class +// no longer makes as much sense as it once did. - public function updateStatus($new_status) { - if (!$this->daemonLog) { - return; - } - - try { - $this->daemonLog - ->setStatus($new_status) - ->save(); - } catch (AphrontQueryException $ex) { - // Ignore anything that goes wrong here. - } - } - - public function getPID() { - return $this->pid; - } - - public function getName() { - return $this->name; - } - - public function getArgv() { - return $this->argv; - } - - public function getEpochStarted() { - return $this->start; - } - - public function getPIDFile() { - return $this->pidFile; - } - - public function getDaemonLog() { - return $this->daemonLog; - } - - public function isRunning() { - return self::isProcessRunning($this->getPID()); - } +final class PhabricatorDaemonReference extends Phobject { public static function isProcessRunning($pid) { if (!$pid) { @@ -148,15 +30,4 @@ return $is_running; } - public function waitForExit($seconds) { - $start = time(); - while (time() < $start + $seconds) { - usleep(100000); - if (!$this->isRunning()) { - return true; - } - } - return !$this->isRunning(); - } - }