Suppose the client making an HTTP request to my WSGI app closes its socket,
say, because the user hit Escape in their web browser.  What happens to my
Python interpreter executing the WSGI code in question?  It keeps running,
right?

This seems pretty unfortunate.  Suppose that the implementation of my HTTP
request needs to go out on the network to talk to some other server.
(Which, in my case, some of them do.)  connect(), send(), recv() can all
take potentially unlimited amounts of time to complete.  They may not
consume any CPU time while they're blocking, but a thread is just sitting
there doing nothing; and what, if anything, will cause that thread to die
short of killing the Apache process or the WSGI daemon process (if any)?
Leak enough threads and you could run out of memory, deadlock, or whatnot.

The behavior I'd think I'd want would be that a closed client socket would
result in a Python KeyboardInterrupt being raised asynchronously inside my
WSGI Python interpreter, exactly like Ctrl-C in a normal Python app.  Then
my code would nicely release any DB locks/rollback any pending DB
transactions as the stack unrolled, and blocking IOs (socket or otherwise)
could be interrupted via a signal (Unix)/IO cancellation (Windows)/some
other mechanism (???).
mod_wsgi daemon mode seems like a partial solution at best:
- daemon mode is not supported on Windows, right?
- killing the daemon process (potentially?) kills other requests, not just
the hung request

And any solution that involves one process per request, well, then we might
as well be back to using CGI rather than WSGI...

-- 
Matt Craighead
Founder/CEO, Conifer Systems LLC
http://www.conifersystems.com
512-772-1834

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to