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

Appearance settings

gh-120321: Fix TSan reported races on gi_frame_state#143128

Merged
colesbury merged 1 commit intopython:mainpython/cpython:mainfrom
colesbury:gh-120321-tsan-racescolesbury/cpython:gh-120321-tsan-racesCopy head branch name to clipboard
Dec 24, 2025
Merged

gh-120321: Fix TSan reported races on gi_frame_state#143128
colesbury merged 1 commit intopython:mainpython/cpython:mainfrom
colesbury:gh-120321-tsan-racescolesbury/cpython:gh-120321-tsan-racesCopy head branch name to clipboard

Conversation

@colesbury
Copy link
Contributor

@colesbury colesbury commented Dec 24, 2025

@colesbury
Copy link
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.

@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
@kumaraditya303
Copy link
Contributor

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

@colesbury
Copy link
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.

@kumaraditya303
Copy link
Contributor

kumaraditya303 commented Dec 24, 2025

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.

_PyGen_Finalize((PyObject *)gen);

@colesbury
Copy link
Contributor Author

That will be fixed in #143112

@colesbury colesbury merged commit 594a463 into python:main Dec 24, 2025
54 checks passed
@colesbury colesbury deleted the gh-120321-tsan-races branch December 24, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.