Page MenuHomePhabricator

Aphlict start causes exception, seemingly when its log file location is changed
OpenPublic

Asked by Ray on Jun 4 2018, 3:15 AM.

Details

I'm in the process of attempting a first-time install of Phabricator on a new dedicated server (Centos 7.5, apache 2.4.33, mariadb 10.1), and am working through configuration of the aphlict server (Browser Notifications).

After carefully following the instructions at https://secure.phabricator.com/book/phabricator/article/notifications/ (and rechecking them multiple times before coming here) along with discovering that the aphlict server needs to be started by my regular user rather than su root, I'm getting an exception that I have been unable to figure out for a few days. Nodejs 6.14.2 was already installed before I came across Phab's instructions to install it for this. Note that it seemed to start up fine before I adjusted the location of the log file as described below. It was only after I had it initially running that I discovered the default location of the log file was outside of where we organize website-related logs. I then tried to stop it with my regular user, and was hit with an exception that I failed to save. I switched to su root, stopped it (seemed to stop without issue), adjusted the log file line as shown below, and then switched back to my regular user to restart it. That's when the phun began.

I copied aphlict.custom.json into the same directory as the default and adjusted only the log file location line as follows:

{
  "servers": [
    {
      "type": "client",
      "port": 22280,
      "listen": "0.0.0.0",
      "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
    }
  ],
  "logs": [
    {
      "path": "/var/log/httpd/dev/aphlict.log"
    }
  ],
  "pidfile": "/var/tmp/aphlict/pid/aphlict.pid"
}

Traceback after adjusting log file line above:

/phabricator]$ bin/aphlict start
Reading configuration from: phabricator/conf/aphlict/aphlict.custom.json
[2018-06-04 02:21:00] ERROR 2: vsprintf(): Too few arguments at [/var/www/dev/lab.lti.org/public/libphutil/src/internationalization/PhutilTranslator.php:136]
arcanist(head=master, ref.master=d581c453b83c), phabricator(head=master, ref.master=5bcca675e1c7), phutil(head=master, ref.master=20eff1c8d14f)
  #0 vsprintf(string, array) called at [<phutil>/src/internationalization/PhutilTranslator.php:136]
  #1 PhutilTranslator::translate(string, string, string)
  #2 call_user_func_array(array, array) called at [<phutil>/src/internationalization/pht.php:17]
  #3 pht(string, string, string) called at [<phabricator>/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php:220]
  #4 PhabricatorAphlictManagementWorkflow::parseLaunchArguments(PhutilArgumentParser) called at [<phabricator>/src/applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php:14]
  #5 PhabricatorAphlictManagementStartWorkflow::execute(PhutilArgumentParser) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:441]
  #6 PhutilArgumentParser::parseWorkflowsFull(array) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:333]
  #7 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/support/aphlict/server/aphlict_launcher.php:23]
Usage Exception: [Invalid Translation!] Failed to create directory "%s" for specified log file (with index "%s"). You should manually create this directory or choose a different logfile location. %s

The traceback info suggests that it is looking to create a directory that already exists (e.g. /var/log/httpd/dev/, or maybe something else, since I can't work out the actual cause of this error).

Any advice you can shine on this situation would be greatly appreciated.

Answers

avivey
Updated 2,146 Days Ago

You're seeing a translation error that is caused by this exception: https://secure.phabricator.com/source/phabricator/browse/master/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php$214-220

This error means that Phabricator couldn't find the directory, tried to create it, and failed.
Make sure the directory actually exists, and is readable and writable by the user running aphlict (and all it's partent directories).

You can apply D19463 locally, which should let you see the real exception, which may shed some light on your issue.

Ray
Updated 2,145 Days Ago

Thank you, sir!
Applying the adjustment shown in D19463 makes it very clear where this issue lies.

Since I still need to have the log where we organize/manage all website-related logs, I suspect I may be able to 'fix' this with ACLs on the log file and its path. If successful (I can't test it immediately), I'll return to here with the details for posterity, and use the Discourse site for any future issues/questions we may hit upon.

Edit: Setting the aphlict_user with rwx on the two offending log path directories indeed allowed this to work.

setfacl -m u:`aphlict_user`:rwx /var/log/httpd/ && setfacl -m u:`aphlict_user`:rwx /var/log/httpd/dev/

New Answer