From 1119f24071be457c2f280191ec63d41023f69076 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 21 Jan 2019 01:58:19 +0000 Subject: [PATCH] issue #414: reinitialize service pool lock on fork --- docs/changelog.rst | 4 ++++ mitogen/fork.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 62f77071..3c7350b5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -298,6 +298,10 @@ Core Library was configured. This would lead to connection timeouts due to the hung response. +* `#414 `_, + `#425 `_: avoid deadlock of forked + children by reinitializing the :mod:`mitogen.service` pool lock. + * `#416 `_: around 1.4KiB of memory was leaked on every RPC, due to a list of strong references keeping alive any handler ever registered for disconnect notification. diff --git a/mitogen/fork.py b/mitogen/fork.py index 3e3a98a9..8636bd13 100644 --- a/mitogen/fork.py +++ b/mitogen/fork.py @@ -85,6 +85,10 @@ def on_fork(): mitogen.core.Latch._on_fork() mitogen.core.Side._on_fork() + mitogen__service = sys.modules.get('mitogen.service') + if mitogen__service: + mitogen__service._pool_lock = threading.Lock() + def handle_child_crash(): """