Page MenuHomePhabricator

Unable to start notifications server because it is already running.
Closed, InvalidPublic

Description

On my system I often get the message:

Usage Exception: Unable to start notifications server because it is already running. Use `aphlict restart` to restart it.

aphlict stop followed by aphlict start (via systemd, see below) does not have any effect. I have to wait a long time, before I can successfully restart it.

I am using this systemd unit to manage it:

[Unit]
Description=Phabricator notification daemon
After=network.target mysql.service

[Service]
User=phd
Type=forking
ExecStart=/opt/phabricator/phabricator/bin/aphlict start
ExecStop=/opt/phabricator/phabricator/bin/aphlict stop

[Install]
WantedBy=multi-user.target

Event Timeline

devurandom raised the priority of this task from to Needs Triage.
devurandom updated the task description. (Show Details)
devurandom added a project: Aphlict.
devurandom added a subscriber: devurandom.

I can't reproduce this. Can you reproduce this if you don't use systemd? Specifically, does aphlict stop followed by aphlict start fail if run manually?

We issue that error message if a PID file is found at the path configured with notification.pidfile. This file should be removed by aphlict stop. On my system, it is, and aphlict start works immediately.

devurandom closed this task as Invalid.EditedFeb 18 2015, 6:36 PM
devurandom claimed this task.

You are right, systemd does not execute ExecStop when running systemctl restart and it considers the service as stopped for whatever reason. I made it aware of the status of the service by adding PIDFile=/var/tmp/aphlict/pid/aphlict.pid, so it will select the appropriate command.

On a sidenote: This also allowed me to set Restart=on-failure.