-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-109582: test_fork_signal_handling should wait for event #109605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Does this need a changelog entry? The failing test was introduced in 3.12. |
No, because it's just a test fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@@ -1911,8 +1913,14 @@ def test_fork_signal_handling(self): | |||
parent_handled = manager.Event() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that another test_asyncio test uses multiprocessing.
It might be interesting to call from multiprocessing.util._cleanup_tests()
in this test file as well: see commit 09ea4b8 and gh-109295.
But this one is less important since it doesn't pull most heavy multiprocessing resources, it's "just" a fork manager :-)
child_started.set() | ||
while True: | ||
time.sleep(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me a while to understand that the child doesn't run the loop forever, but is interrupted by SIGTERM and so exits immediately.
@@ -1933,6 +1941,7 @@ async def func(): | |||
|
|||
asyncio.run(main()) | |||
|
|||
child_handled.wait(timeout=support.SHORT_TIMEOUT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that's a good way to synchronize the parent and the child.
Merged thanks. I copied your rationale in the commit message. IMO it's important to keep it. |
…honGH-109605) Sometimes the child_handled event was missing because either the child quits before it gets a chance to handle the signal, or the parent asserts before the event notification is delivered via IPC. Synchronize explicitly to avoid this. (cherry picked from commit 608c1f3) Co-authored-by: Davide Rizzo <[email protected]>
GH-109695 is a backport of this pull request to the 3.12 branch. |
|
|
…hon#109605) Sometimes the child_handled event was missing because either the child quits before it gets a chance to handle the signal, or the parent asserts before the event notification is delivered via IPC. Synchronize explicitly to avoid this.
…-109605) (#109695) gh-109582: test_fork_signal_handling should wait for event (GH-109605) Sometimes the child_handled event was missing because either the child quits before it gets a chance to handle the signal, or the parent asserts before the event notification is delivered via IPC. Synchronize explicitly to avoid this. (cherry picked from commit 608c1f3) Co-authored-by: Davide Rizzo <[email protected]>
…hon#109605) Sometimes the child_handled event was missing because either the child quits before it gets a chance to handle the signal, or the parent asserts before the event notification is delivered via IPC. Synchronize explicitly to avoid this.
Sometimes the child_handled event was missing because either the child quits before it gets a chance to handle the signal, or the parent asserts before the event notification is delivered via IPC. Synchronize explicitly to avoid this.