summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/managers.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/multiprocessing/managers.py')
-rw-r--r--Lib/multiprocessing/managers.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py
index 2bad636..5141522 100644
--- a/Lib/multiprocessing/managers.py
+++ b/Lib/multiprocessing/managers.py
@@ -21,6 +21,7 @@ import signal
import array
import queue
import time
+import os
from os import getpid
from traceback import format_exc
@@ -1349,6 +1350,14 @@ if HAS_SHMEM:
_Server = SharedMemoryServer
def __init__(self, *args, **kwargs):
+ if os.name == "posix":
+ # bpo-36867: Ensure the resource_tracker is running before
+ # launching the manager process, so that concurrent
+ # shared_memory manipulation both in the manager and in the
+ # current process does not create two resource_tracker
+ # processes.
+ from . import resource_tracker
+ resource_tracker.ensure_running()
BaseManager.__init__(self, *args, **kwargs)
util.debug(f"{self.__class__.__name__} created by pid {getpid()}")