forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix child process watchers racing to free PIDs managed by Popen
Note that we call Popen.poll/wait in the event loop thread to avoid Popen's thread-unsafety. Without this workaround, when testing _ThreadedChildWatcher with the reproducer shared in the linked issue on my machine: * Case 1 of the known race condition ignored in pythonGH-20010 is met (and an unsafe kill call is issued) about 1 in 10 times. * The race condition pythonGH-127050 is met (causing _process_exited's assert returncode is not None to raise) about 1 in 30 times.
- Loading branch information
1 parent
a50f0b8
commit 65cce5c
Showing
5 changed files
with
50 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Misc/NEWS.d/next/Library/2024-11-19-21-58-18.gh-issue-127049.dk76iD.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Fix race condition where :meth:`asyncio.subprocess.Process.send_signal`, | ||
:meth:`asyncio.subprocess.Process.terminate`, and | ||
:meth:`asyncio.subprocess.Process.kill` could signal an already-freed PID on | ||
non-Windows platforms. Patch by Ganden Schaffner. |