New submission from STINNER Victor: With debug patches for bpo-26762, I noticed that some unit tests of test_multiprocessing_spawn leaks "dangling" processes: --- haypo@selma$ ./python -m test --fail-env-changed test_multiprocessing_spawn -v --match test.test_multiprocessing_spawn.WithProcessesTestPool.test_context == CPython 3.7.0a0 (heads/master:b364d9f, Jul 24 2017, 11:06:33) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] == Linux-4.11.9-200.fc25.x86_64-x86_64-with-fedora-25-Twenty_Five little-endian == hash algorithm: siphash24 64bit == cwd: /home/haypo/prog/python/master/build/test_python_20982 == CPU count: 4 == encodings: locale=UTF-8, FS=utf-8 Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0) Run tests sequentially 0:00:00 load avg: 0.16 [1/1] test_multiprocessing_spawn test_context (test.test_multiprocessing_spawn.WithProcessesTestPool) ... ok Warning -- Dangling processes: {<SpawnProcess(SpawnPoolWorker-6, stopped[SIGTERM] daemon)>} Dangling processes: {<SpawnProcess(SpawnPoolWorker-6, stopped[SIGTERM] daemon)>}
---------------------------------------------------------------------- Ran 1 test in 1.342s OK test_multiprocessing_spawn failed (env changed) 1 test altered the execution environment: test_multiprocessing_spawn Total duration: 1 sec Tests result: ENV CHANGED --- multiprocessing.Pool.terminate() doesn't call the join() method of a Process object if its is_alive() method returns false. But in practice, avoid the join() creates "dangling" processes. Attached pull request fixes the warning: Pool.terminate() now calls join() on all processes including "dead" processes. ---------- components: Library (Lib) messages: 299002 nosy: haypo priority: normal severity: normal status: open title: multiprocessing.Pool should join "dead" processes type: resource usage versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31019> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com