Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash if log directory doesn't exist #629

Closed
mnaberez opened this issue Jul 3, 2015 · 4 comments
Closed

Crash if log directory doesn't exist #629

mnaberez opened this issue Jul 3, 2015 · 4 comments
Labels

Comments

@mnaberez
Copy link
Member

mnaberez commented Jul 3, 2015

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.

@mattvonrocketstein
Copy link

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

@mnaberez
Copy link
Member Author

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.

@bopjiang
Copy link

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.

mnaberez added a commit that referenced this issue Aug 18, 2015
mnaberez added a commit that referenced this issue Aug 18, 2015
@mnaberez
Copy link
Member Author

Fixed in fd22ca8. 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

alexsilva pushed a commit to alexsilva/supervisor that referenced this issue Jun 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants