]> granicus.if.org Git - python/commitdiff
bpo-33056 FIX leaking fd in concurrent.futures.ProcessPoolExecutor (GH-6084) (#6092)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 13 Mar 2018 09:10:57 +0000 (02:10 -0700)
committerAntoine Pitrou <pitrou@free.fr>
Tue, 13 Mar 2018 09:10:57 +0000 (10:10 +0100)
(cherry picked from commit 095ee415cee41bf24c3a1108c23307e5baf168dd)

Co-authored-by: Thomas Moreau <thomas.moreau.2010@gmail.com>
Lib/concurrent/futures/process.py
Misc/NEWS.d/next/Library/2018-03-12-16-40-00.bpo-33056.lNN9Eh.rst [new file with mode: 0644]

index aaa5151e017c0f7421b6ec06dbfc7cac0895d793..63f22cfca3252c59cec7b9abf3ba84ecb47b4486 100644 (file)
@@ -78,11 +78,13 @@ _global_shutdown = False
 
 
 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 @@ class ProcessPoolExecutor(_base.Executor):
             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 (file)
index 0000000..6acc19a
--- /dev/null
@@ -0,0 +1 @@
+FIX properly close leaking fds in concurrent.futures.ProcessPoolExecutor.