diff options
author | Pierre Glaser <pierreglaser@msn.com> | 2019-05-13 19:15:32 (GMT) |
---|---|---|
committer | Antoine Pitrou <antoine@python.org> | 2019-05-13 19:15:32 (GMT) |
commit | b1dfcad6f0d3a52c9ac31fb9763fc7962a84b27c (patch) | |
tree | 09626029048cab5bbe61912b30c91ee988652874 /Lib/multiprocessing | |
parent | be6939fb02e65b56c45377940b339d150b124d05 (diff) | |
download | cpython-b1dfcad6f0d3a52c9ac31fb9763fc7962a84b27c.zip cpython-b1dfcad6f0d3a52c9ac31fb9763fc7962a84b27c.tar.gz cpython-b1dfcad6f0d3a52c9ac31fb9763fc7962a84b27c.tar.bz2 |
bpo-36867: Create the resource_tracker before launching SharedMemoryManagers (GH-13276)
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/managers.py | 9 |
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()}") |