Issue #14574: Ignore socket errors raised when flushing a connection on close.

parent 8c3dab23
...@@ -299,8 +299,8 @@ request. ...@@ -299,8 +299,8 @@ request.
.. method:: RequestHandler.finish() .. method:: RequestHandler.finish()
Called after the :meth:`handle` method to perform any clean-up actions Called after the :meth:`handle` method to perform any clean-up actions
required. The default implementation does nothing. If :meth:`setup` or required. The default implementation does nothing. If :meth:`setup`
:meth:`handle` raise an exception, this function will not be called. raises an exception, this function will not be called.
.. method:: RequestHandler.handle() .. method:: RequestHandler.handle()
......
...@@ -700,7 +700,12 @@ class StreamRequestHandler(BaseRequestHandler): ...@@ -700,7 +700,12 @@ class StreamRequestHandler(BaseRequestHandler):
def finish(self): def finish(self):
if not self.wfile.closed: if not self.wfile.closed:
try:
self.wfile.flush() self.wfile.flush()
except socket.error:
# An final socket error may have occurred here, such as
# the local error ECONNABORTED.
pass
self.wfile.close() self.wfile.close()
self.rfile.close() self.rfile.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment