Skip to content

Commit 2aea0e9

Browse files
miss-islingtonronaldoussorenAA-Turner
authored
[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 c7d59bd) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent fa7d8e9 commit 2aea0e9

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Lib/multiprocessing/managers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def __init__(self, registry, address, authkey, serializer):
153153
Listener, Client = listener_client[serializer]
154154

155155
# do authentication later
156-
self.listener = Listener(address=address, backlog=16)
156+
self.listener = Listener(address=address, backlog=128)
157157
self.address = self.listener.address
158158

159159
self.id_to_obj = {'0': (None, ())}

Lib/multiprocessing/resource_sharer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def _start(self):
123123
from .connection import Listener
124124
assert self._listener is None, "Already have Listener"
125125
util.debug('starting listener and thread for sending handles')
126-
self._listener = Listener(authkey=process.current_process().authkey)
126+
self._listener = Listener(authkey=process.current_process().authkey, backlog=128)
127127
self._address = self._listener.address
128128
t = threading.Thread(target=self._serve)
129129
t.daemon = True
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Increase the backlog for :class:`multiprocessing.connection.Listener` objects created
2+
by :mod:`multiprocessing.manager` and :mod:`multiprocessing.resource_sharer` to
3+
significantly reduce the risk of getting a connection refused error when creating
4+
a :class:`multiprocessing.connection.Connection` to them.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy