Apply the first chunk of the second patch from SF bug #471720:
ThreadingMixIn/TCPServer forgets close (Max Neunhöffer). This ensures that handle_error() and close_request() are called when an error occurs in the thread. (I am not applying the second chunk of the patch, which moved the finish() call into the finally clause in BaseRequestHandler's __init__ method; that would be a semantic change that I cannot accept at this point - the data would be sent even if the handler raised an exception.)
This commit is contained in:
parent
00ebd46dfc
commit
83c3281826
|
@ -449,9 +449,17 @@ class ThreadingMixIn:
|
||||||
"""Mix-in class to handle each request in a new thread."""
|
"""Mix-in class to handle each request in a new thread."""
|
||||||
|
|
||||||
def process_request_thread(self, request, client_address):
|
def process_request_thread(self, request, client_address):
|
||||||
"""Same as in BaseServer but as a thread."""
|
"""Same as in BaseServer but as a thread.
|
||||||
self.finish_request(request, client_address)
|
|
||||||
self.close_request(request)
|
In addition, exception handling is done here.
|
||||||
|
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
self.finish_request(request, client_address)
|
||||||
|
self.close_request(request)
|
||||||
|
except:
|
||||||
|
self.handle_error(request, client_address)
|
||||||
|
self.close_request(request)
|
||||||
|
|
||||||
def process_request(self, request, client_address):
|
def process_request(self, request, client_address):
|
||||||
"""Start a new thread to process the request."""
|
"""Start a new thread to process the request."""
|
||||||
|
|
Loading…
Reference in New Issue