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-117657: Quiet TSAN warning about a data race between `start_the_world()` and `tstate_try_attach()` by mpage · Pull Request #117828 · python/cpython

Conversation

@mpage

@mpage mpage commented Apr 12, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

TSAN erroneously reports a data race (example) between the _Py_atomic_compare_exchange_int on tstate->state in tstate_try_attach():

cpython/Python/pystate.c

Lines 1993 to 1995 in 069de14

return _Py_atomic_compare_exchange_int(&tstate->state,
&expected,
_Py_THREAD_ATTACHED);

and the non-atomic load of tstate->state in start_the_world():

cpython/Python/pystate.c

Line 2251 in 069de14

assert(t->state == _Py_THREAD_SUSPENDED);

The _Py_atomic_compare_exchange_int fails, but TSAN erroneously treats it as a store.

  • Issue: Make TSAN tests pass with the GIL disabled in free-threaded builds #117657

Sorry, something went wrong.

Uh oh!

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

All reactions
@mpage
Quiet TSAN warning about a data race between start_the_world() and …
eb46a18
…`tstate_try_attach()`

TSAN erroneously reports a data race between the `_Py_atomic_compare_exchange_int`
on `tstate->state` in `tstate_try_attach()` and the non-atomic load of
`tstate->state` in `start_the_world`. The `_Py_atomic_compare_exchange_int` fails,
but TSAN erroneously treats it as a store.
@bedevere-app bedevere-app Bot mentioned this pull request Apr 12, 2024
Make TSAN tests pass with the GIL disabled in free-threaded builds #117657
Closed
@mpage mpage added the skip news label Apr 12, 2024
colesbury
colesbury reviewed Apr 12, 2024
View reviewed changes
Comment thread Python/pystate.c Resolved

Uh oh!

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

@mpage
Use a relaxed load
61bd2fa
@mpage
mpage marked this pull request as ready for review April 12, 2024 22:22
@mpage
mpage requested a review from ericsnowcurrently as a code owner April 12, 2024 22:22
@bedevere-app bedevere-app Bot added the awaiting review label Apr 12, 2024
@mpage
mpage requested a review from colesbury April 12, 2024 22:23
@mpage mpage mentioned this pull request Apr 13, 2024
gh-117657: Quiet more TSAN warnings due to incorrect modeling of compare/exchange #117830
Merged
colesbury
colesbury approved these changes Apr 15, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Apr 15, 2024
@colesbury
colesbury merged commit 6e0b327 into python:main Apr 15, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 15, 2024
mpage added a commit to mpage/cpython that referenced this pull request Apr 16, 2024
@mpage
Remove unneeded free-threading suppressions
da4df93
The underlying races were fixed in pythongh-117830 and pythongh-117828
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
@mpage @diegorusso
pythongh-117657: Quiet TSAN warning about a data race between `start_…
2b5a7e4
…the_world()` and `tstate_try_attach()` (python#117828)

TSAN erroneously reports a data race between the `_Py_atomic_compare_exchange_int`
on `tstate->state` in `tstate_try_attach()` and the non-atomic load of
`tstate->state` in `start_the_world`. The `_Py_atomic_compare_exchange_int` fails,
but TSAN erroneously treats it as a store.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@colesbury colesbury colesbury approved these changes
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

skip news

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

@mpage @colesbury
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.