Supervisor crashes when log file is not writable
erlandl4g opened this issue · 1 comments
When Supervisor is started with non root user, but log file remains to be owned by root - supervisor crashes upon restart.
Mems_allowed_list: 0-3
voluntary_ctxt_switches: 25
nonvoluntary_ctxt_switches: 1
PythonArgs: ['/usr/bin/supervisord', '-n', '-c', '/etc/supervisor/supervisord.conf']
Traceback:
Traceback (most recent call last):
File "/usr/bin/supervisord", line 33, in <module>
sys.exit(load_entry_point('supervisor==4.2.1', 'console_scripts', 'supervisord')())
File "/usr/lib/python3/dist-packages/supervisor/supervisord.py", line 361, in main
go(options)
File "/usr/lib/python3/dist-packages/supervisor/supervisord.py", line 371, in go
d.main()
File "/usr/lib/python3/dist-packages/supervisor/supervisord.py", line 72, in main
self.options.make_logger()
File "/usr/lib/python3/dist-packages/supervisor/options.py", line 1470, in make_logger
loggers.handle_file(
File "/usr/lib/python3/dist-packages/supervisor/loggers.py", line 417, in handle_file
handler = RotatingFileHandler(filename, 'a', maxbytes, backups)
File "/usr/lib/python3/dist-packages/supervisor/loggers.py", line 213, in __init__
FileHandler.__init__(self, filename, mode)
File "/usr/lib/python3/dist-packages/supervisor/loggers.py", line 160, in __init__
self.stream = open(filename, mode)
PermissionError: [Errno 13] Permission denied: '/var/log/supervisor/supervisord.log'
UserGroups: N/A
This could be changed to try and keep going with logging disabled but many users run supervisord
as a daemon. With no stdout
and no logfile, supervisord
wouldn't have a way to notify the user that anything is wrong. The problem may go unnoticed until sometime later when the user looks in the logfile and finds it is mysteriously out of date.
Crashing as it does now seems like a better behavior to me ("fail early"). supervisord
can't fulfill the requested configuration and doesn't have a way of communicating this to the user since logging doesn't work, so it just dies. The user is forced to fix the permissions mistake right away.