[Twisted-web] Socket timeout in web2 (lost socket)
ashish.jha at gmail.com
Tue Jan 8 02:45:45 EST 2008
I have a HTTP connection where the client has died, and twisted.web2
is getting stuck waiting for data. Can anyone tell me how to
timeout this case?
- client connects to server to perform a POST (XMLRPC in this case)
- twisted accepts connection, hands off to twisted.web2
- twisted.web2 wsgi handler runs wsgi app in a thread
- wsgi app tries to read the full body, based on Content-Length
- client dies before sending all the data
(crashes or disconnects without TCP connection being closed)
- wsgi app thread is stuck forever in read()
File "D:\LabManager-Jan-07-2\src\wsgi\XMLRPCServer.py", line 98, in
data =3D environ['wsgi.input'].read(length)
File "D:\LabManager-Jan-07-2\src\twisted\web2\wsgi.py", line 66, in read
return callInReactor(self.stream.readExactly, size)
File "D:\LabManager-Jan-07-2\src\twisted\web2\wsgi.py", line 48, in
result =3D queue.get()
File "D:\LabManager-Jan-07-2\python24\lib\Queue.py", line 119, in get
File "D:\LabManager-Jan-07-2\Python24\lib\threading.py", line 203, in wait
The function self.stream.readExactly is BufferedStream.readExactly
(wsgi.py, line 987).
However, it's not clear how to fix this up, since there seems to be
another class in the middle i.e. _NotifyingProducerStream (and
it's base class ProducerStream)
Does anyone have any example code for this, or can you give me a rough
guide on how to implement this?
(I am using Python 2.4.3, Twisted 2.4.0, and Twisted.Web2 0.2.0)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-web