-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-33056 FIX leaking fd in concurrent.futures.ProcessPoolExecutor #6084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-33056 FIX leaking fd in concurrent.futures.ProcessPoolExecutor #6084
Conversation
Please add a NEWS entry |
@asvetlov: Please replace |
Thank you for the fast review! I will try to use |
@tomMoral sure. |
GH-6092 is a backport of this pull request to the 3.7 branch. |
…ythonGH-6084) (cherry picked from commit 095ee41) Co-authored-by: Thomas Moreau <[email protected]>
…H-6084) (#6092) (cherry picked from commit 095ee41) Co-authored-by: Thomas Moreau <[email protected]>
@tomMoral, I believe that either this change and/or #3895 causes
I'm not sure what the right solution is here, obviously this change is to prevent leaking the file descriptors which are taken care of in the close(), but perhaps the |
@rad-pat Thanks a lot for the reproducing script! there is 2 issues here:
|
…ckling failure (GH-17670) As reported initially by @rad-pat in #6084, the following script causes a deadlock. ``` from concurrent.futures import ProcessPoolExecutor class ObjectWithPickleError(): """Triggers a RuntimeError when sending job to the workers""" def __reduce__(self): raise RuntimeError() if __name__ == "__main__": e = ProcessPoolExecutor() f = e.submit(id, ObjectWithPickleError()) e.shutdown(wait=False) f.result() # Deadlock on get ``` This is caused by the fact that the main process is closing communication channels that might be necessary to the `queue_management_thread` later. To avoid this, this PR let the `queue_management_thread` manage all the closing. https://bugs.python.org/issue39104 Automerge-Triggered-By: @pitrou
…ckling failure (GH-17670) As reported initially by @rad-pat in #6084, the following script causes a deadlock. ``` from concurrent.futures import ProcessPoolExecutor class ObjectWithPickleError(): """Triggers a RuntimeError when sending job to the workers""" def __reduce__(self): raise RuntimeError() if __name__ == "__main__": e = ProcessPoolExecutor() f = e.submit(id, ObjectWithPickleError()) e.shutdown(wait=False) f.result() # Deadlock on get ``` This is caused by the fact that the main process is closing communication channels that might be necessary to the `queue_management_thread` later. To avoid this, this PR let the `queue_management_thread` manage all the closing. https://bugs.python.org/issue39104 Automerge-Triggered-By: @pitrou
The recent changes introduced by #3895 leaks some file descriptors (the Pipe open in _ThreadWakeup, see here).
They should be properly closed at shutdown.
https://bugs.python.org/issue33056