summaryrefslogtreecommitdiffstats
path: root/Lib/SocketServer.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-05-21 16:12:30 (GMT)
committerGuido van Rossum <guido@python.org>1999-05-21 16:12:30 (GMT)
commit18659608dcc5eb92182d07240641a696bad5fd7b (patch)
tree935c6257b0e22dfa0c67901106f393f10aed1720 /Lib/SocketServer.py
parentb6f8cf123eda17204ad2002a205dd25a2107f86d (diff)
downloadcpython-18659608dcc5eb92182d07240641a696bad5fd7b.zip
cpython-18659608dcc5eb92182d07240641a696bad5fd7b.tar.gz
cpython-18659608dcc5eb92182d07240641a696bad5fd7b.tar.bz2
Andy Dustman writes:
I noticed while watching (with lsof) my forking SocketServer app running that I would get multiple processes listening to the socket. For the most part, this doesn't hurt things, but if you terminate the server, this can prevent it from restarting because it cannot bind to the port due to any running children which also have the socket open. The following one-liner fixes this.
Diffstat (limited to 'Lib/SocketServer.py')
-rw-r--r--Lib/SocketServer.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py
index 23f3a8e..d8081ef 100644
--- a/Lib/SocketServer.py
+++ b/Lib/SocketServer.py
@@ -304,6 +304,7 @@ class ForkingMixIn:
os._exit(0)
except:
try:
+ self.socket.close()
self.handle_error(request,
client_address)
finally: