2010/1/8 Alec Flett <[email protected]>: > .. some years ago while running mod_python and Python 2.4, we were having > problems with GracefulShutdownTimeout - some kind of race condition where > the python interpreter would occasionally get wedged (I don't remember > details, something about an atexit handler, the GIL, and some other > nonsense?) The only solution for us at the time was to stop using > GracefulShutdownTimeout and thus shut the children down hard, which makes > our software upgrades a little clunky because we kill outstanding requests. > (the details are long and sordid as to why we didn't just kill the wedged > processes....) I also remember that the same problem existed with mod_wsgi > in embedded mode because of some fundamental issue embedding the python > interpreter in an apache process.
The same problem should not exist in mod_wsgi so long as you are only loading mod_wsgi and are not still loading mod_python into the same Apache instance. The reason you will still have a problem if loading mod_python is because mod_python is deferred to in respect of Python interpreter initialisation and destruction. As a consequence, so long as mod_python is still loaded, you will be affected by bugs which are present in mod_python. Note that this assumes the specific problem you were having was actually caused by mod_python, which is possible as it does do things wrongly in that area, but you could just as easily trigger it in your own application code if not written correctly as far as interpreter shutdown is concerned. > I'm curious if anyone has had this problem before, and if daemon mode's > fundamental architecture is one that would avoid this issue? We were seeing > this really rarely (like every 5 or 10 apache restarts, a single child would > get wedged) so it's hard to really know if it's fixed until we go into > production and let the children sit around a while. > > We're now using daemon mode, and we'd like to turn GracefulShutdownTimeout, > hoping this will work. But it's really hard to really see if this will be > fixed until we try it in a production environment, which is never good. I'm > hoping to get some kind of answer like "Yes, daemon mode avoids this > entirely" or "No, you'll have the same issue with daemon mode" or even "This > is different in Python 2.6 and higher because the GIL has been changed...." There is no graceful shutdown for mod_wsgi daemon mode processes. Even when Apache graceful restart or shutdown is done, mod_wsgi daemon mode processes are killed off after 3 seconds if they don't shutdown of their own accord. This is in part a restriction within Apache as graceful process shutdown only applies to Apache's own server child processes and not what are designated as APR other child processes, which is how mod_wsgi daemon mode processes are managed within context of Apache parent process. As such, if using daemon mode, there is still a risk that long running requests can be aborted while being executed. So, if need true graceful process restart semantics, you would need to use embedded mode, but then you would also have to be careful about Apache configuration and memory usage issues as partly described in: http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usage.html Graham
-- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
