diff --git a/Lib/socketserver.py b/Lib/socketserver.py index 089b3bac112..f42802c27a9 100644 --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -549,10 +549,10 @@ class ForkingMixIn: self.active_children = [] self.active_children.append(pid) self.close_request(request) - return else: # Child process. # This must never return, hence os._exit()! + self.socket.close() try: self.finish_request(request, client_address) self.shutdown_request(request) diff --git a/Misc/NEWS b/Misc/NEWS index fac8078edbe..fc54f8905af 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,8 @@ Core and Builtins Library ------- +- Issue #5715: In socketserver, close the server socket in the child process. + - Correct lookup of __dir__ on objects. Among other things, this causes errors besides AttributeError found on lookup to be propagated.