[3.7] bpo-33725: multiprocessing uses spawn by default on macOS (GH-13603) by vstinner · Pull Request #13626 · python/cpython
Failure on macOS:
1342======================================================================
1343FAIL: test_preload_resources (test.test_multiprocessing_forkserver.TestStartMethod)
1344----------------------------------------------------------------------
1345Traceback (most recent call last):
1346 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/test/_test_multiprocessing.py", line 4469, in test_preload_resources
1347 self.fail("failed spawning forkserver or grandchild")
1348AssertionError: failed spawning forkserver or grandchild
1349
1350Stdout:
1351
1352Traceback (most recent call last):
1353 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/forkserver.py", line 261, in main
1354 old_handlers)
1355 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/forkserver.py", line 297, in _serve_one
1356 code = spawn._main(child_r)
1357 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/spawn.py", line 114, in _main
1358 prepare(preparation_data)
1359 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/spawn.py", line 225, in prepare
1360 _fixup_main_from_path(data['init_main_from_path'])
1361 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/spawn.py", line 277, in _fixup_main_from_path
1362 run_name="__mp_main__")
1363 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/runpy.py", line 263, in run_path
1364 pkg_name=pkg_name, script_name=fname)
1365 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/runpy.py", line 96, in _run_module_code
1366 mod_name, mod_spec, pkg_name, script_name)
1367 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/runpy.py", line 85, in _run_code
1368 exec(code, run_globals)
1369 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/test/mp_preload.py", line 3, in <module>
1370 multiprocessing.Lock()
1371 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/context.py", line 67, in Lock
1372 return Lock(ctx=self.get_context())
1373 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/synchronize.py", line 162, in __init__
1374 SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
1375 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/synchronize.py", line 80, in __init__
1376 register(self._semlock.name)
1377 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/semaphore_tracker.py", line 83, in register
1378 self._send('REGISTER', name)
1379 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/semaphore_tracker.py", line 90, in _send
1380 self.ensure_running()
1381 File "/Users/vsts/agent/2.150.3/work/1/s/Lib/multiprocessing/semaphore_tracker.py", line 46, in ensure_running
1382 pid, status = os.waitpid(self._pid, os.WNOHANG)
1383ChildProcessError: [Errno 10] No child processes