I use tornado 2.0 and sometimes when I call self.finish () to end the asynchronous request, I get an IOError with the message "Stream is closed". It seems like this happens when the client finishes the request (i.e. by going to another page) before the server () call is completed. Is this the expected behavior and something I need for my code? I found this error a year ago, and this suggests that this is not what the client code should handle: https://github.com/facebook/tornado/issues/81 . This indicates an error in my code, and if so, what are the probable reasons?
Stacktrace:
Traceback (most recent call last): File "my_code.py", line 260, in my_method self.finish() File "/usr/lib/python2.6/site-packages/tornado/web.py", line 634, in finish self.request.finish() File "/usr/lib/python2.6/site-packages/tornado/httpserver.py", line 555, in finish self.connection.finish() File "/usr/lib/python2.6/site-packages/tornado/httpserver.py", line 349, in finish self._finish_request() File "/usr/lib/python2.6/site-packages/tornado/httpserver.py", line 372, in _finish_request self.stream.read_until(b("\r\n\r\n"), self._header_callback) File "/usr/lib/python2.6/site-packages/tornado/iostream.py", line 137, in read_until self._check_closed() File "/usr/lib/python2.6/site-packages/tornado/iostream.py", line 403, in _check_closed raise IOError("Stream is closed") IOError: Stream is closed
source share