From 2647f735010c532dae4e6bcce3d7203097e72499 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 7 Sep 2018 13:43:39 +0100 Subject: [PATCH] ansible: bump UNIX listener default backlog, and set it to match forks. The connection multiplexer can expect to not be scheduled at least until every $forks worker processes has attempted a connection, so the backlog must be able to hold every worker. --- ansible_mitogen/process.py | 2 ++ mitogen/unix.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ansible_mitogen/process.py b/ansible_mitogen/process.py index c5e4c016..daffe7cf 100644 --- a/ansible_mitogen/process.py +++ b/ansible_mitogen/process.py @@ -50,6 +50,7 @@ import mitogen.service import mitogen.unix import mitogen.utils +import ansible.constants as C import ansible_mitogen.logging import ansible_mitogen.services @@ -204,6 +205,7 @@ class MuxProcess(object): self.listener = mitogen.unix.Listener( router=self.router, path=self.unix_listener_path, + backlog=C.DEFAULT_FORKS, ) self._enable_router_debug() self._enable_stack_dumps() diff --git a/mitogen/unix.py b/mitogen/unix.py index efcc59cc..1097596b 100644 --- a/mitogen/unix.py +++ b/mitogen/unix.py @@ -63,7 +63,7 @@ def make_socket_path(): class Listener(mitogen.core.BasicStream): keep_alive = True - def __init__(self, router, path=None, backlog=30): + def __init__(self, router, path=None, backlog=100): self._router = router self.path = path or make_socket_path() self._sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)