This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2017-07-24.17:36:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1500917798.24.0.0382753367873.issue31019@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-07-24 17:36:38vstinnersetrecipients: + vstinner
2017-07-24 17:36:38vstinnersetmessageid: <1500917798.24.0.0382753367873.issue31019@psf.upfronthosting.co.za>
2017-07-24 17:36:38vstinnerlinkissue31019 messages
2017-07-24 17:36:38vstinnercreate