Supervisor fails to restart half of the time
This is not necessarily an error from supervisor. I see from your systemctl status
output that supervisor
is started through the sysv-init compatibility layer, so the failure could be in the /etc/init.d/supervisor
script. It would explain the absence of errors in the supervisord logs.
To debug the init script, the easiest way is to add a set -x
as first non-comment instruction in that file, and look in the journalctl
output the trace of the script execution.
EDIT:
I've reproduced and debugged it on a test system with Debian Sid.
The issue is that the stop target of the supervisor init-script does not check if the daemon has been really terminated but only send a signal if the process exists. If the daemon process takes a while to shutdown, the subsequent start action will fail due to the dying daemon process, which is counted as already running.
I've opened a bug on Debian Bug Tracker: http://bugs.debian.org/805920
WORKAROUND:
You can workaround the issue with:
/etc/init.d/supervisor force-stop && \
/etc/init.d/supervisor stop && \
/etc/init.d/supervisor start
force-stop
will ensure the supervisord has been terminated (outside systemd).stop
make sure systemd know it's terminatedstart
starts it again
The stop
after the force-stop
is required otherwise systemd will ignore any subsequent start
request. stop
and start
can be combined using restart
, but here I've put both of them to show how it works.