[Python-checkins] bpo-33056 FIX leaking fd in concurrent.futures.ProcessPoolExecutor (GH-6084) (#6092)

Antoine Pitrou webhook-mailer at python.org
Tue Mar 13 05:11:00 EDT 2018


https://github.com/python/cpython/commit/f216cbf9ab704da98146a25d57ff0e85aecb49da
commit: f216cbf9ab704da98146a25d57ff0e85aecb49da
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Antoine Pitrou <pitrou at free.fr>
date: 2018-03-13T10:10:57+01:00
summary:

bpo-33056 FIX leaking fd in concurrent.futures.ProcessPoolExecutor (GH-6084) (#6092)

(cherry picked from commit 095ee415cee41bf24c3a1108c23307e5baf168dd)

Co-authored-by: Thomas Moreau <thomas.moreau.2010 at gmail.com>

files:
A Misc/NEWS.d/next/Library/2018-03-12-16-40-00.bpo-33056.lNN9Eh.rst
M Lib/concurrent/futures/process.py

diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py
index aaa5151e017c..63f22cfca325 100644
--- a/Lib/concurrent/futures/process.py
+++ b/Lib/concurrent/futures/process.py
@@ -78,11 +78,13 @@
 
 
 class _ThreadWakeup:
-    __slot__ = ["_state"]
-
     def __init__(self):
         self._reader, self._writer = mp.Pipe(duplex=False)
 
+    def close(self):
+        self._writer.close()
+        self._reader.close()
+
     def wakeup(self):
         self._writer.send_bytes(b"")
 
@@ -654,6 +656,11 @@ def shutdown(self, wait=True):
             self._call_queue = None
         self._result_queue = None
         self._processes = None
+
+        if self._queue_management_thread_wakeup:
+            self._queue_management_thread_wakeup.close()
+            self._queue_management_thread_wakeup = None
+
     shutdown.__doc__ = _base.Executor.shutdown.__doc__
 
 atexit.register(_python_exit)
diff --git a/Misc/NEWS.d/next/Library/2018-03-12-16-40-00.bpo-33056.lNN9Eh.rst b/Misc/NEWS.d/next/Library/2018-03-12-16-40-00.bpo-33056.lNN9Eh.rst
new file mode 100644
index 000000000000..6acc19a36dc8
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-03-12-16-40-00.bpo-33056.lNN9Eh.rst
@@ -0,0 +1 @@
+FIX properly close leaking fds in concurrent.futures.ProcessPoolExecutor.



More information about the Python-checkins mailing list