GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-120321: Fix TSan reported races on gi_frame_state by colesbury · Pull Request #143128 · python/cpython

Conversation

@colesbury

@colesbury colesbury commented Dec 24, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Issue: SIGSEGV with generators in free-threaded build #120321

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@colesbury
pythongh-120321: Fix TSan reported races on gi_frame_state
4720897
@colesbury colesbury added skip news topic-free-threading labels Dec 24, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Dec 24, 2025
SIGSEGV with generators in free-threaded build #120321
Closed
@colesbury

colesbury commented Dec 24, 2025

Copy link
Copy Markdown
Contributor Author

This is the same thing as #142995, but I missed a few cases. Again, I think these are false positives in the sense that TSan treats failed compare-exchanges as if they are modifications, when they don't perform any modification on failure.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@colesbury
colesbury requested a review from mpage December 24, 2025 00:24
@colesbury
colesbury marked this pull request as ready for review December 24, 2025 00:24
@colesbury
colesbury requested a review from markshannon as a code owner December 24, 2025 00:24
@bedevere-app bedevere-app Bot added the awaiting core review label Dec 24, 2025
@kumaraditya303

kumaraditya303 commented Dec 24, 2025

Copy link
Copy Markdown
Contributor

In _PyGen_Finalize there are a few non-atomic reads of gi_frame_state, does that need fixing as well?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@colesbury

colesbury commented Dec 24, 2025

Copy link
Copy Markdown
Contributor Author

No, _PyGen_Finalize is called when there are no other references to the generator (except cycles), so there's no concurrent compare-exchanges on gi_frame_state.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303

kumaraditya303 commented Dec 24, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

No, _PyGen_Finalize is called when there are no other references to the generator (except cycles), so there's no concurrent compare-exchanges on gi_frame_state.

It is possible that _PyGen_Finalize gets called from frame.clear though so IIUC it is not guaranteed to be called only when there are no other references to generator.

cpython/Objects/frameobject.c

Line 2025 in d4dc3dd

_PyGen_Finalize((PyObject *)gen);

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@colesbury

colesbury commented Dec 24, 2025

Copy link
Copy Markdown
Contributor Author

That will be fixed in #143112

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kumaraditya303
kumaraditya303 approved these changes Dec 24, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Dec 24, 2025
@colesbury
colesbury merged commit 594a463 into python:main Dec 24, 2025
54 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@colesbury
colesbury deleted the gh-120321-tsan-races branch December 24, 2025 21:10
@bedevere-app bedevere-app Bot removed the awaiting merge label Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes
@mpage mpage Awaiting requested review from mpage
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news topic-free-threading

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@colesbury @kumaraditya303
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.