manage.py runfcgi dies in response to SIGHUP/SIGUSR1, disallows log rotation
|Reported by:||robbyd||Owned by:||nobody|
|Component:||Core (Management commands)||Version:||1.0|
|Severity:||Normal||Keywords:||runfcgi, fastcgi, SIGHUP, log rotation|
|Cc:||robbyd@…, alexkoshelev, spoof@…, mateusz@…||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Thanks to #6687, daemonized fastcgi processes can now log their stderr and stdout. In our environment we would like to capture these logs, and rotate them (via the standard method of using logrotate). However, from looking in the code, it appears that runfcgi does not support closing/reopening its log file (which would allow logrotate to rotate the log out from under it). Sending a SIGUSR1 or SIGHUP to the master fcgi PID simply kills it instead of causing it to do this. Unless I'm missing something, it looks like the only way to do this at the time is to stop and then restart the processes, which is unacceptable in a production environment.
A necessary patch would handle a SIGUSR1 and/or SIGHUP to close() and then re open() the files specified in errlog and outlog.
I can write a patch if necessary using the python signal module.
Change History (10)
comment:1 Changed 5 years ago by robbyd
- Cc robbyd@… added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 5 years ago by Alex
- Triage Stage changed from Unreviewed to Design decision needed
comment:9 Changed 12 months ago by aaugustin
- Component changed from Core (Other) to Core (Management commands)