Commit 3766f18c authored by Pablo Galindo's avatar Pablo Galindo Committed by GitHub

bpo-35378: Fix multiprocessing.Pool references (GH-11627)

Changes in this commit:

1. Use a _strong_ reference between the Pool and associated iterators
2. Rework PR #8450 to eliminate a cycle in the Pool.

There is no test in this commit because any test that automatically tests this behaviour needs to eliminate the pool before joining the pool to check that the pool object is garbaged collected/does not hang. But doing this will potentially leak threads and processes (see https://bugs.python.org/issue35413).
parent 4b250fc1
This diff is collapsed.
......@@ -2593,7 +2593,6 @@ class _TestPool(BaseTestCase):
pool = None
support.gc_collect()
def raising():
raise KeyError("key")
......
Fix a reference issue inside :class:`multiprocessing.Pool` that caused
the pool to remain alive if it was deleted without being closed or
terminated explicitly. A new strong reference is added to the pool
iterators to link the lifetime of the pool to the lifetime of its
iterators so the pool does not get destroyed if a pool iterator is
still alive.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment