[Twisted-web] what happens when browsers close the connection?

Phil Christensen phil at bubblehouse.org
Fri Jul 27 17:25:44 EDT 2007


Sorry to be so noisy lately, but I've run into another strange  
problem with web2.wsgi, or more likely, my understanding of it.

I'm seeing issues when the browser connection is closed uncleanly,  
particularly when doing a "fast reload" and clicking the reload  
before the first request/response has completed.

My specific issue is that when this happens, if I'm in the middle of  
a MySQL query (which in my app, I usually am), subsequent calls to  
<Cursor>.execute() are failing because the previous resultset was  
never freed.

This is only an issue when using web2 (or my custom twisted.web wsgi  
layer, which still uses web2's wsgi.WSGIHandler class). Apache/ 
mod_python seems to allow each request to continue to completion  
behind the scenes, although it makes up for it by crashing horribly  
in other ways.

What I'd like to know is what exactly happens when a browser closes a  
connection? Is there any possibility that the lost connection event  
has some implications further up the call chain? Could any of this  
somehow stop or kill the thread created in WSGIResource.renderHTTP()?

-phil



More information about the Twisted-web mailing list