Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-133744: Fix multiprocessing interrupt test: add an event #133746

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

Merged
merged 1 commit into from
May 12, 2025

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented May 9, 2025

Add an event to synchronize the parent process with the child process: wait until the child process starts sleeping.

Add an event to synchronize the parent process with the child
process: wait until the child process starts sleeping.
@vstinner vstinner added tests Tests in the Lib/test dir topic-multiprocessing labels May 9, 2025
@vstinner vstinner marked this pull request as ready for review May 9, 2025 12:56
@vstinner vstinner requested a review from gpshead as a code owner May 9, 2025 12:56
@vstinner
Copy link
Member Author

vstinner commented May 9, 2025

cc @gpshead @colesbury @pitrou

Without this change, the SIGINT signal can be sent too early: in multiprocessing setup code.

@vstinner
Copy link
Member Author

vstinner commented May 9, 2025

With this change, I can no longer reproduce the issue:

$ ./python -m test test_multiprocessing_spawn.test_processes -m test_interrupt_no_handler -m test_interrupt -m test_terminate -m test_kill  -W -F -j14
...
0:02:04 load avg: 17.62 [180] test_multiprocessing_spawn.test_processes passed
0:02:04 load avg: 18.13 [181] test_multiprocessing_spawn.test_processes passed
0:02:06 load avg: 18.13 [182] test_multiprocessing_spawn.test_processes passed

@vstinner
Copy link
Member Author

vstinner commented May 9, 2025

Since 2013, there was a workaround for this issue, using a simple sleep(1): commit 26f9268.

        # XXX maybe terminating too soon causes the problems on Gentoo...
        time.sleep(1)

@vstinner vstinner merged commit c2989b7 into python:main May 12, 2025
45 checks passed
@vstinner vstinner deleted the mp_interrupt branch May 12, 2025 09:10
@vstinner vstinner added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels May 12, 2025
@miss-islington-app
Copy link

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @vstinner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c2989b7070b18c0b7c51521fed8bc11c159ea5b8 3.13

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 12, 2025
…thonGH-133746)

Add an event to synchronize the parent process with the child
process: wait until the child process starts sleeping.
(cherry picked from commit c2989b7)

Co-authored-by: Victor Stinner <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented May 12, 2025

GH-133916 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label May 12, 2025
@bedevere-app
Copy link

bedevere-app bot commented May 12, 2025

GH-133917 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label May 12, 2025
vstinner added a commit to vstinner/cpython that referenced this pull request May 12, 2025
…thon#133746)

Add an event to synchronize the parent process with the child
process: wait until the child process starts sleeping.

(cherry picked from commit c2989b7)
vstinner added a commit that referenced this pull request May 12, 2025
…H-133746) (#133916)

gh-133744: Fix multiprocessing interrupt test: add an event (GH-133746)

Add an event to synchronize the parent process with the child
process: wait until the child process starts sleeping.
(cherry picked from commit c2989b7)

Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this pull request May 12, 2025
…133746) (#133917)

gh-133744: Fix multiprocessing interrupt test: add an event (#133746)

Add an event to synchronize the parent process with the child
process: wait until the child process starts sleeping.

(cherry picked from commit c2989b7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir topic-multiprocessing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant