[Web-SIG] A 'shutdown' function in WSGI

Tarek Ziadé ziade.tarek at gmail.com
Tue Feb 21 08:53:43 CET 2012


On Tue, Feb 21, 2012 at 2:39 AM, Graham Dumpleton <
graham.dumpleton at gmail.com> wrote:

> ...
> Overall the best chance of being able to do anything is relying on atexit.
>
> You are though at the mercy of the WSGI hosting mechanism shutting
> down the process and so the interpreter, in an orderly manner such
> that atexit callbacks get called.
>
> In Apache/mod_wsgi you get this guarantee, even in sub interpreters
> where atexit callbacks wouldn't normally be called when they are
> destroyed.
>
> For uWSGI, atexit callbacks will not be called at the moment, by
> Robert is making changes to it so you get a guarantee there as well.
> It is possible he is only doing this though for case where main
> interpreter is being used, as doing it for sub interpreters is a bit
> fiddly.
>
>
But I don't think you can guarantee that everything is still up in memory
by the time atexit gets called,
so you can't really call cleanup code there.


Any pure Python WSGI servers shouldn't have issues so long as they
> aren't force exiting the whole process and bypassing normal
> interpreter destruction.
>

what do you mean by bypassing its destruction ?

Cheers
Tarek



>
> Graham
> _______________________________________________
> Web-SIG mailing list
> Web-SIG at python.org
> Web SIG: http://www.python.org/sigs/web-sig
> Unsubscribe:
> http://mail.python.org/mailman/options/web-sig/ziade.tarek%40gmail.com
>



-- 
Tarek Ziadé | http://ziade.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/web-sig/attachments/20120221/ad554032/attachment-0001.html>


More information about the Web-SIG mailing list