Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-135099: Only wait on_PyOS_SigintEvent() in main thread#135100

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
encukou merged 2 commits intopython:mainfromcolesbury:gh-135099-parking-lot-crash
Jun 4, 2025

Conversation

colesbury
Copy link
Contributor

@colesburycolesbury commentedJun 3, 2025
edited by bedevere-appbot
Loading

On Windows, the_PyOS_SigintEvent() event handle is used to interrupt the main thread when Ctrl-C is pressed. Previously, we also waited on the event from other threads, but ignored the result. However, this can race with interpreter shutdown because the main thread closes the handle in_PySignal_Fini and threads may still be running and using mutexes during interpreter shtudown.

Only use_PyOS_SigintEvent() in the main thread in parking_lot.c, like we do in other places in the CPython codebase.

On Windows, the `_PyOS_SigintEvent()` event handle is used to interruptthe main thread when Ctrl-C is pressed. Previously, we also waited onthe event from other threads, but ignored the result. However, this canrace with interpreter shutdown because the main thread closes the handlein `_PySignal_Fini` and threads may still be running and using mutexesduring interpreter shtudown.Only use `_PyOS_SigintEvent()` in the main thread in parking_lot.c, likewe do in other places in the CPython codebase.
@colesbury
Copy link
ContributorAuthor

Manually verified that Ctrl-C still interrupts lock acquisitions on Windows.

@colesburycolesbury marked this pull request as ready for reviewJune 3, 2025 19:08
@colesbury
Copy link
ContributorAuthor

!buildbot Windows

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@colesbury for commit7c7d96e 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F135100%2Fmerge

The command will test the builders whose names match following regular expression:Windows

The builders matched are:

  • AMD64 Windows11 Bigmem PR
  • AMD64 Windows PGO PR
  • ARM64 Windows Non-Debug PR
  • ARM64 Windows PR
  • AMD64 Windows11 Refleaks PR
  • AMD64 Windows Server 2022 NoGIL PR
  • AMD64 Windows11 Non-Debug PR
  • AMD64 Windows PGO NoGIL PR
  • AMD64 Windows10 PR

@encukou
Copy link
Member

Thank you! The Windows buildbots look very happy with this change.

@encukouencukou merged commitcc581f3 intopython:mainJun 4, 2025
52 checks passed
@miss-islington-app
Copy link

Thanks@colesbury for the PR, and@encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJun 4, 2025
…ythonGH-135100)On Windows, the `_PyOS_SigintEvent()` event handle is used to interruptthe main thread when Ctrl-C is pressed. Previously, we also waited onthe event from other threads, but ignored the result. However, this canrace with interpreter shutdown because the main thread closes the handlein `_PySignal_Fini` and threads may still be running and using mutexesduring interpreter shtudown.Only use `_PyOS_SigintEvent()` in the main thread in parking_lot.c, likewe do in other places in the CPython codebase.(cherry picked from commitcc581f3)Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app
Copy link

GH-135116 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelJun 4, 2025
@colesburycolesbury deleted the gh-135099-parking-lot-crash branchJune 4, 2025 12:44
colesbury added a commit that referenced this pull requestJun 4, 2025
…H-135100) (GH-135116)On Windows, the `_PyOS_SigintEvent()` event handle is used to interruptthe main thread when Ctrl-C is pressed. Previously, we also waited onthe event from other threads, but ignored the result. However, this canrace with interpreter shutdown because the main thread closes the handlein `_PySignal_Fini` and threads may still be running and using mutexesduring interpreter shtudown.Only use `_PyOS_SigintEvent()` in the main thread in parking_lot.c, likewe do in other places in the CPython codebase.(cherry picked from commitcc581f3)Co-authored-by: Sam Gross <colesbury@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mpagempagempage approved these changes

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrently

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@colesbury@bedevere-bot@encukou@mpage

[8]ページ先頭

©2009-2025 Movatter.jp