bpo-34172: multiprocessing.Pool leaks resources after being deleted by tzickel · Pull Request #8450 · python/cpython

pitrou

@tzickel

Due to a circular reference inside the Pool implementation, there
was a resource leak if the object was not closed/terminated.
This patch removes the circular reference, and now the code acts
like the documentation.

@pitrou

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Oct 2, 2018
…ythonGH-8450)

Fix a reference issue inside multiprocessing.Pool that caused the pool to remain alive if it was deleted without being closed or terminated explicitly.
(cherry picked from commit 97bfe8d)

Co-authored-by: tzickel <tzickel@users.noreply.github.com>

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Oct 2, 2018
…ythonGH-8450)

Fix a reference issue inside multiprocessing.Pool that caused the pool to remain alive if it was deleted without being closed or terminated explicitly.
(cherry picked from commit 97bfe8d)

Co-authored-by: tzickel <tzickel@users.noreply.github.com>

pitrou pushed a commit that referenced this pull request

Oct 2, 2018
…H-8450) (GH-9676)

Fix a reference issue inside multiprocessing.Pool that caused the pool to remain alive if it was deleted without being closed or terminated explicitly.
(cherry picked from commit 97bfe8d)

Co-authored-by: tzickel <tzickel@users.noreply.github.com>

pitrou pushed a commit that referenced this pull request

Oct 2, 2018
…H-8450) (GH-9677)

Fix a reference issue inside multiprocessing.Pool that caused the pool to remain alive if it was deleted without being closed or terminated explicitly.
(cherry picked from commit 97bfe8d)

Co-authored-by: tzickel <tzickel@users.noreply.github.com>

tzickel added a commit to tzickel/cpython that referenced this pull request

Oct 3, 2018

@tzickel

vstinner added a commit that referenced this pull request

Dec 6, 2018

vstinner added a commit that referenced this pull request

Dec 6, 2018

vstinner added a commit that referenced this pull request

Dec 6, 2018

pablogsal added a commit that referenced this pull request

Feb 11, 2019
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).

@tzickel tzickel mannequin mentioned this pull request

Apr 10, 2022