Reported in the comments of issue #120:
I don't know if that's been solved somehow in the master branch, but in version 3.1.1, someone accidentally removed a log directory in our server, and supervisor simply stopped working, taking all other programs with it, not just the one with the log directory missing.
I've seen and been annoyed by this behavior also. I think the correct behaviour is to create logdir if possible, and at minimum it should not be allowed to crash other tasks
I've seen and been annoyed by this behavior also.
When does it occur? The original comment is not specific. Does a crash occur when stdout_logfile
in a [program:x]
section specifies a log directory that does not exist? What Supervisor version are you using?
I think the correct behaviour is to create logdir if possible
I don't use any other program that has a behavior like this. supervisord
doesn't have enough information to automatically create a log directory, since it doesn't know what user should own the directory or what the permissions should be. I think the only thing it can do without growing a bunch of options for all this is to show a clear error message when a log directory doesn't exist.
at minimum it should not be allowed to crash other tasks
I agree that adding a [program:x]
section where stdout_logfile
or stderr_logfile
specifies a directory that does not exist should not crash supervisord
.
Does a crash occur when stdout_logfile in a [program:x] section specifies a log directory that does not > exist? What Supervisor version are you using?
Yes. Some problem on 3.1.3 for me.
Fixed in fd22ca89ff353fbe92845e9d2517645e6cf149ac. This fix will be included in Supervisor 3.2.
Here is how to duplicate it and verify it is fixed. Minimal supervisord.conf
:
[supervisord]
logfile = /tmp/supervisord.log
[inet_http_server]
port = 127.0.0.1:9001
[supervisorctl]
serverurl = http://127.0.0.1:9001
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[program:cat]
command = /bin/cat
stdout_logfile = /thelogdir/foo.txt
autostart = false
The log directory must exist or supervisord
will refuse to start. Create the log directory and start supervisord
in the foreground with that config:
$ mkdir /thelogdir
$ supervisord --version
3.2.0.dev0
$ supervisord -n -c /path/to/supervisord.conf
2015-08-18 14:38:52,503 INFO Increased RLIMIT_NOFILE limit to 1024
2015-08-18 14:38:52,516 INFO RPC interface 'supervisor' initialized
2015-08-18 14:38:52,516 CRIT Server 'inet_http_server' running without any HTTP authentication checking
2015-08-18 14:38:52,516 INFO supervisord started with pid 49508
Remove the log directory while supervisord
is still running:
$ rmdir /thelogdir
Try to start the process:
$ supervisorctl -c /path/to/supervisord.conf
cat STOPPED Not started
supervisor> start cat
cat: ERROR (spawn error)
supervisor> status
cat FATAL unknown error making dispatchers for 'cat': ENOENT
Most helpful comment
Fixed in fd22ca89ff353fbe92845e9d2517645e6cf149ac. This fix will be included in Supervisor 3.2.
Here is how to duplicate it and verify it is fixed. Minimal
supervisord.conf
:The log directory must exist or
supervisord
will refuse to start. Create the log directory and startsupervisord
in the foreground with that config:Remove the log directory while
supervisord
is still running:Try to start the process: