]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-107219: Fix concurrent.futures terminate_broken() (GH-109244) (#109255)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 11 Sep 2023 08:52:17 +0000 (01:52 -0700)
committerGitHub <noreply@github.com>
Mon, 11 Sep 2023 08:52:17 +0000 (08:52 +0000)
commit2f8c80f531808999e0cf37095107e4e8c074ba06
tree59ba64755eaef6323ed8a611cc35c5f300812f2b
parenta7e80fb62872127c23ada5cd80fb1251ba19fbd2
[3.11] gh-107219: Fix concurrent.futures terminate_broken() (GH-109244) (#109255)

gh-107219: Fix concurrent.futures terminate_broken() (GH-109244)

Fix a race condition in concurrent.futures. When a process in the
process pool was terminated abruptly (while the future was running or
pending), close the connection write end. If the call queue is
blocked on sending bytes to a worker process, closing the connection
write end interrupts the send, so the queue can be closed.

Changes:

* _ExecutorManagerThread.terminate_broken() now closes
  call_queue._writer.
* multiprocessing PipeConnection.close() now interrupts
  WaitForMultipleObjects() in _send_bytes() by cancelling the
  overlapped operation.
(cherry picked from commit a9b1f84790e977fb09f75b148c4c4f5924a6ef99)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/concurrent/futures/process.py
Lib/multiprocessing/connection.py
Misc/NEWS.d/next/Library/2023-09-11-00-32-18.gh-issue-107219.3zqyFT.rst [new file with mode: 0644]