From: Richard Oudkerk Date: Mon, 15 Jul 2013 17:37:48 +0000 (+0100) Subject: Issue #18455: multiprocessing should not retry connect() with same socket. X-Git-Tag: v2.7.6rc1~296 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8ef9bc69471b3f5a789dad61d2330cf8193926c;p=thirdparty%2FPython%2Fcpython.git Issue #18455: multiprocessing should not retry connect() with same socket. --- diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index a05173015107..1a29c36f6391 100644 --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -294,15 +294,16 @@ def SocketClient(address): ''' Return a connection object connected to the socket given by `address` ''' - family = address_type(address) - s = socket.socket( getattr(socket, family) ) - s.setblocking(True) + family = getattr(socket, address_type(address)) t = _init_timeout() while 1: + s = socket.socket(family) + s.setblocking(True) try: s.connect(address) except socket.error, e: + s.close() if e.args[0] != errno.ECONNREFUSED or _check_timeout(t): debug('failed to connect to address %s', address) raise diff --git a/Misc/NEWS b/Misc/NEWS index e074d7fc08c0..0b2dadfb81ec 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -26,6 +26,8 @@ Core and Builtins Library ------- +- Issue #18455: multiprocessing should not retry connect() with same socket. + - Issue #18101: Tcl.split() now process Unicode strings nested in a tuple as it do with byte strings.