Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15285353
D11040.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11040.diff
View Options
diff --git a/src/daemon/PhutilDaemonOverseer.php b/src/daemon/PhutilDaemonOverseer.php
--- a/src/daemon/PhutilDaemonOverseer.php
+++ b/src/daemon/PhutilDaemonOverseer.php
@@ -107,7 +107,6 @@
$log = $args->getArg('log');
if ($log) {
- ini_set('error_log', $log);
$argv[] = '--log='.$log;
}
@@ -122,8 +121,6 @@
$this->argv = $argv;
$this->moreArgs = coalesce($more, array());
- error_log("Bringing daemon '{$this->daemon}' online...");
-
if (self::$instance) {
throw new Exception(
'You may not instantiate more than one Overseer per process.');
@@ -131,6 +128,28 @@
self::$instance = $this;
+ // Check this before we daemonize, since if it's an issue the child will
+ // exit immediately.
+ if ($this->phddir) {
+ $dir = $this->phddir;
+ try {
+ Filesystem::assertWritable($dir);
+ } catch (Exception $ex) {
+ throw new Exception(
+ "Specified daemon PID directory ('{$dir}') does not exist or is ".
+ "not writable by the daemon user!");
+ }
+ }
+
+ if ($log) {
+ // NOTE: Now that we're committed to daemonizing, redirect the error
+ // log if we have a `--log` parameter. Do this at the last moment
+ // so as many setup issues as possible are surfaced.
+ ini_set('error_log', $log);
+ }
+
+ error_log("Bringing daemon '{$this->daemon}' online...");
+
if ($this->daemonize) {
// We need to get rid of these or the daemon will hang when we TERM it
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 5, 1:07 PM (5 d, 4 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7225601
Default Alt Text
D11040.diff (1 KB)
Attached To
Mode
D11040: Check daemon piddir writability before forking in daemons
Attached
Detach File
Event Timeline
Log In to Comment