summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-01-14 15:29:15 (GMT)
committerGitHub <noreply@github.com>2024-01-14 15:29:15 (GMT)
commit2aea0e967a28aa1dc7729e28dd36dd9abf50e24b (patch)
tree611898f714c8c9292b0770f1778290c52c630e82
parentfa7d8e97c2a604fcd2c4f44815e83c9742ad2177 (diff)
downloadcpython-2aea0e967a28aa1dc7729e28dd36dd9abf50e24b.zip
cpython-2aea0e967a28aa1dc7729e28dd36dd9abf50e24b.tar.gz
cpython-2aea0e967a28aa1dc7729e28dd36dd9abf50e24b.tar.bz2
[3.12] gh-101225: Increase the socket backlog when creating a multiprocessing.connection.Listener (GH-113567) (#114018)
gh-101225: Increase the socket backlog when creating a multiprocessing.connection.Listener (GH-113567) Increase the backlog for multiprocessing.connection.Listener` objects created by `multiprocessing.manager` and `multiprocessing.resource_sharer` to significantly reduce the risk of getting a connection refused error when creating a `multiprocessing.connection.Connection` to them. (cherry picked from commit c7d59bd8cfa053e77ae3446c82afff1fd38a4886) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
-rw-r--r--Lib/multiprocessing/managers.py2
-rw-r--r--Lib/multiprocessing/resource_sharer.py2
-rw-r--r--Misc/NEWS.d/next/Library/2023-12-29-17-46-06.gh-issue-101225.QaEyxF.rst4
3 files changed, 6 insertions, 2 deletions
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py
index b653493..75d9c18 100644
--- a/Lib/multiprocessing/managers.py
+++ b/Lib/multiprocessing/managers.py
@@ -153,7 +153,7 @@ class Server(object):
Listener, Client = listener_client[serializer]
# do authentication later
- self.listener = Listener(address=address, backlog=16)
+ self.listener = Listener(address=address, backlog=128)
self.address = self.listener.address
self.id_to_obj = {'0': (None, ())}
diff --git a/Lib/multiprocessing/resource_sharer.py b/Lib/multiprocessing/resource_sharer.py
index 6607650..b8afb0f 100644
--- a/Lib/multiprocessing/resource_sharer.py
+++ b/Lib/multiprocessing/resource_sharer.py
@@ -123,7 +123,7 @@ class _ResourceSharer(object):
from .connection import Listener
assert self._listener is None, "Already have Listener"
util.debug('starting listener and thread for sending handles')
- self._listener = Listener(authkey=process.current_process().authkey)
+ self._listener = Listener(authkey=process.current_process().authkey, backlog=128)
self._address = self._listener.address
t = threading.Thread(target=self._serve)
t.daemon = True
diff --git a/Misc/NEWS.d/next/Library/2023-12-29-17-46-06.gh-issue-101225.QaEyxF.rst b/Misc/NEWS.d/next/Library/2023-12-29-17-46-06.gh-issue-101225.QaEyxF.rst
new file mode 100644
index 0000000..ab3c3a5
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-12-29-17-46-06.gh-issue-101225.QaEyxF.rst
@@ -0,0 +1,4 @@
+Increase the backlog for :class:`multiprocessing.connection.Listener` objects created
+by :mod:`multiprocessing.manager` and :mod:`multiprocessing.resource_sharer` to
+significantly reduce the risk of getting a connection refused error when creating
+a :class:`multiprocessing.connection.Connection` to them.