Skip to content

gh-117657: Fix TSAN race in free-threaded GC - #119883

Merged
colesbury merged 1 commit into
python:mainfrom
colesbury:gh-117657-gc
Jun 1, 2024
Merged

gh-117657: Fix TSAN race in free-threaded GC#119883
colesbury merged 1 commit into
python:mainfrom
colesbury:gh-117657-gc

Conversation

@colesbury

@colesburycolesbury commented May 31, 2024

Copy link
Copy Markdown
Contributor

Only call gc_restore_tid() from stop-the-world contexts. worklist_pop() can be called while other threads are running, so use a relaxed atomic to modify ob_tid.

Only call `gc_restore_tid()` from stop-the-world contexts.
`worklist_pop()` can be called while other threads are running, so use a
relaxed atomic to modify `ob_tid`.

@Fidget-SpinnerFidget-Spinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to work on deferred rc, I now have a somewhat okay-ish grasp on the free-threaded GC code. This LGTM.

@colesbury

Copy link
Copy Markdown
ContributorAuthor

Thanks!

@colesbury
colesbury merged commit 60593b2 into python:mainJun 1, 2024
@miss-islington-app

Copy link
Copy Markdown

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

@colesbury
colesbury deleted the gh-117657-gc branch June 1, 2024 14:04
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 1, 2024
Only call `gc_restore_tid()` from stop-the-world contexts.
`worklist_pop()` can be called while other threads are running, so use a
relaxed atomic to modify `ob_tid`.
(cherry picked from commit 60593b2)
Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app

Copy link
Copy Markdown

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

@bedevere-appbedevere-appBot removed the needs backport to 3.13 bugs and security fixes label Jun 1, 2024
colesbury added a commit that referenced this pull request Jun 1, 2024
)
Only call `gc_restore_tid()` from stop-the-world contexts.
`worklist_pop()` can be called while other threads are running, so use a
relaxed atomic to modify `ob_tid`.
(cherry picked from commit 60593b2)
Co-authored-by: Sam Gross <colesbury@gmail.com>
barneygale pushed a commit to barneygale/cpython that referenced this pull request Jun 5, 2024
Only call `gc_restore_tid()` from stop-the-world contexts.
`worklist_pop()` can be called while other threads are running, so use a
relaxed atomic to modify `ob_tid`.
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
Only call `gc_restore_tid()` from stop-the-world contexts.
`worklist_pop()` can be called while other threads are running, so use a
relaxed atomic to modify `ob_tid`.
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
Only call `gc_restore_tid()` from stop-the-world contexts.
`worklist_pop()` can be called while other threads are running, so use a
relaxed atomic to modify `ob_tid`.
Sign up for freeto 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

@colesbury@Fidget-Spinner