I have an Aphlict configuration where I've omitted the "logs" option. However, due to a bug in the code handling the PID file path, it doesn't work with this option omitted.
This is the offending code in src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php on line 277:
$pid_path = $this->getPIDPath(); try { $dir = dirname($path); if (!Filesystem::pathExists($dir)) { Filesystem::createDirectory($dir, 0755, true); } } catch (FilesystemException $ex) { throw new PhutilArgumentUsageException( pht( 'Failed to create directory "%s" for specified PID file. You '. 'should manually create this directory or choose a different '. 'PID file location. %s', $dir, $ex->getMessage())); }
The third line should be $pid_path. The reason it works when "logs" is specified is that the logs logic uses a $path variable so it gets set, but when it's omitted the variable doesn't get set.
Replication Steps:
Do:
cat >conf/aphlict/aphlict.default.json <<EOF { "servers": [ { "type": "client", "port": 22280, "listen": "127.0.0.1", "ssl.key": null, "ssl.cert": null, "ssl.chain": null }, { "type": "admin", "port": 22281, "listen": "127.0.0.1", "ssl.key": null, "ssl.cert": null, "ssl.chain": null } ], "pidfile": "/run/watch/aphlict" } EOF
Then try running bin/aphlict start.
Expected Results:
Aphlict should start.
Actual Results:
Aphlict crashes with a stack trace due to path being an undefined variable:
june@linux-vlf2:~/Projects/phabricator-real/phabricator> bin/aphlict start Reading configuration from: phabricator/conf/aphlict/aphlict.default.json [2016-04-24 07:43:37] EXCEPTION: (RuntimeException) Undefined variable: path at [<phutil>/src/error/PhutilErrorHandler.php:210] arcanist(head=master, ref.master=a2ab38df78a9), phabricator(head=master, ref.master=00885edc47d4), phutil(head=master, ref.master=b8058f6e29ba) #0 PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<phabricator>/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php:277] #1 PhabricatorAphlictManagementWorkflow::parseLaunchArguments(PhutilArgumentParser) called at [<phabricator>/src/applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php:14] #2 PhabricatorAphlictManagementStartWorkflow::execute(PhutilArgumentParser) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:410] #3 PhutilArgumentParser::parseWorkflowsFull(array) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:303] #4 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/support/aphlict/server/aphlict_launcher.php:23]