diff options
author | Thomas Moreau <thomas.moreau.2010@gmail.com> | 2018-03-12 17:18:41 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2018-03-12 17:18:41 (GMT) |
commit | 095ee415cee41bf24c3a1108c23307e5baf168dd (patch) | |
tree | ae5db621988c154d7a0481eabc053c6b3b1eef73 | |
parent | 5d2a27de625caf2fd5b763d8a8463790ccd954be (diff) | |
download | cpython-095ee415cee41bf24c3a1108c23307e5baf168dd.zip cpython-095ee415cee41bf24c3a1108c23307e5baf168dd.tar.gz cpython-095ee415cee41bf24c3a1108c23307e5baf168dd.tar.bz2 |
bpo-33056 FIX leaking fd in concurrent.futures.ProcessPoolExecutor (#6084)
-rw-r--r-- | Lib/concurrent/futures/process.py | 11 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2018-03-12-16-40-00.bpo-33056.lNN9Eh.rst | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py index aaa5151..63f22cf 100644 --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -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 index 0000000..6acc19a --- /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. |