When using daemon mode of mod_wsgi that is how it works unfortunately. This is 
because Apache only extends gracious shutdown to its own child worker processes 
and not to managed daemon processes.

So the daemon processes only get up to 5 seconds to terminate of their own 
accord when sent the signal from the Apache parent process, before the Apache 
parent will send them a SIGKILL. So if you have long running requests they will 
get terminated if they run longer than 5 seconds.

If this is an issue, the only option you would have is too not use logrotate 
and use Apache's own mechanism for log file rotation, which doesn't have this 
issue because it doesn't need a restart to work.

You could also perhaps use mod_wsgi-express to run separately managed instance, 
using its own log file rotation, and proxy from the main Apache instance.

Graham

> On 13 Jun 2018, at 1:31 pm, Sujai Kumar <sujai.san...@gmail.com> wrote:
> 
> Hello All,
> 
> As part of logrotate config, the httpd process is getting reloaded on a set 
> time. I was of impression that this should not affect the django serving 
> (under apache). On the contrary, I see that the django processes are killed 
> abruptly on httpd reload. 
> 
> I read through the below documentation on apache stop/start/restart/reload 
> and it says that the reload should be gracious (which I expected to be 
> applicable to underlying django process too)
> 
> https://httpd.apache.org/docs/2.4/stopping.html 
> <https://httpd.apache.org/docs/2.4/stopping.html> 
> 
> On the other hand the httpd restart graciously restarts the underlying django 
> process (Meaning: If a process is being served by django, all the other 
> django processes that are not serving any requests currently goes for a 
> restart and the one that is serving currently will wait for the current 
> request to be served completely and then respawns again)
> 
> 
> I was expecting the reload behavior to be gracious to django process. Is 
> there some setting that needs to be done specifically to tweak this behavior? 
> Thanks.
> 
> Thanks & regards,
> Sujaikumar
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to modwsgi+unsubscr...@googlegroups.com 
> <mailto:modwsgi+unsubscr...@googlegroups.com>.
> To post to this group, send email to modwsgi@googlegroups.com 
> <mailto:modwsgi@googlegroups.com>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to