diff options
| author | Barry Warsaw | 2017-08-29 14:07:54 +0000 |
|---|---|---|
| committer | Barry Warsaw | 2017-08-29 14:07:54 +0000 |
| commit | ae0042a90220119414f61aeb20c6b58bfacb8af2 (patch) | |
| tree | 6fd2038427fbb36d8173fe338d277351cd19727b /src/mailman/bin/master.py | |
| parent | f847e15407bfbf824236547bdf728a1ae00bd405 (diff) | |
| download | mailman-ae0042a90220119414f61aeb20c6b58bfacb8af2.tar.gz mailman-ae0042a90220119414f61aeb20c6b58bfacb8af2.tar.zst mailman-ae0042a90220119414f61aeb20c6b58bfacb8af2.zip | |
Diffstat (limited to 'src/mailman/bin/master.py')
| -rw-r--r-- | src/mailman/bin/master.py | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/mailman/bin/master.py b/src/mailman/bin/master.py index 0b273d332..8339f0fc2 100644 --- a/src/mailman/bin/master.py +++ b/src/mailman/bin/master.py @@ -45,22 +45,23 @@ SUBPROC_START_WAIT = timedelta(seconds=20) # Environment variables to forward into subprocesses. PRESERVE_ENVS = ( 'COVERAGE_PROCESS_START', - 'MAILMAN_EXTRA_TESTING_CFG', 'LANG', 'LANGUAGE', - 'LC_CTYPE', - 'LC_NUMERIC', - 'LC_TIME', + 'LC_ADDRESS', + 'LC_ALL', 'LC_COLLATE', - 'LC_MONETARY', + 'LC_CTYPE', + 'LC_IDENTIFICATION', + 'LC_MEASUREMENT', 'LC_MESSAGES', - 'LC_PAPER', + 'LC_MONETARY', 'LC_NAME', - 'LC_ADDRESS', + 'LC_NUMERIC', + 'LC_PAPER', 'LC_TELEPHONE', - 'LC_MEASUREMENT', - 'LC_IDENTIFICATION', - 'LC_ALL', + 'LC_TIME', + 'MAILMAN_EXTRA_TESTING_CFG', + 'PYTHONPATH', ) @@ -188,6 +189,9 @@ class PIDWatcher: def __init__(self): self._pids = {} + def __contains__(self, pid): + return pid in self._pids.keys() + def __iter__(self): # Safely iterate over all the keys in the dictionary. Because # asynchronous signals are involved, the dictionary's size could @@ -312,16 +316,16 @@ class Loop: env = {'MAILMAN_UNDER_MASTER_CONTROL': '1'} # Craft the command line arguments for the exec() call. rswitch = '--runner=' + spec - # Wherever master lives, so too must live the runner script. - exe = os.path.join(config.BIN_DIR, 'runner') - # config.PYTHON, which is the absolute path to the Python interpreter, - # must be given as argv[0] due to Python's library search algorithm. - args = [sys.executable, sys.executable, exe, rswitch] # Always pass the explicit path to the configuration file to the # sub-runners. This avoids any debate about which cfg file is used. config_file = (config.filename if self._config_file is None else self._config_file) - args.extend(['-C', config_file]) + # Wherever master lives, so too must live the runner script. + exe = os.path.join(config.BIN_DIR, 'runner') # pragma: nocover + # config.PYTHON, which is the absolute path to the Python interpreter, + # must be given as argv[0] due to Python's library search algorithm. + args = [sys.executable, sys.executable, exe, # pragma: nocover + '-C', config_file, rswitch] log = logging.getLogger('mailman.runner') log.debug('starting: %s', args) # We must pass this environment variable through if it's set, @@ -399,9 +403,13 @@ class Loop: except ChildProcessError: # No children? We're done. break - except InterruptedError: # pragma: nocover + except InterruptedError: # pragma: nocover # If the system call got interrupted, just restart it. continue + if pid not in self._kids: # pragma: nocover + # This is not a runner subprocess that we own. E.g. maybe a + # plugin started it. + continue # Find out why the subprocess exited by getting the signal # received or exit status. if os.WIFSIGNALED(status): |
