Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache + mod_wsgi + flask app: doing graceful restart due to receiving SIGUSR1 signal

I have flask/python2.7/apache2/mod_wsgi app and periodically I can see the following lines in apache log and my application gets restarted:

[mpm_event:notice] AH00493: SIGUSR1 received.  Doing graceful restart
[wsgi:error] Joining threads

I know that such "graceful restart" can happen if there was segfault, but as far as I can see there was no segfault in my case (no corresponding lines in log before line 'doing graceful restart'). Or maybe such event wasn't logged... anyway I suspect this is apache2 issue because mpm_event is apache2 internal entity (docs).

So my questions are:

1) How to check what's wrong in my case?

2) If this is default behavior (restarting if there is no activity for example) rather than issue - how to configure it and where?

Thanks!

like image 809
Artsiom Praneuski Avatar asked Mar 06 '23 00:03

Artsiom Praneuski


1 Answers

This is because your system has logrotate setup to handle log rotation for Apache. It will send a graceful restart signal to Apache to have it reload while it swaps out the log files.

If this isn't desirable, don't have logrotate do that and use Apache's own mechanism for log file rotation.

like image 168
Graham Dumpleton Avatar answered Mar 15 '23 11:03

Graham Dumpleton