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-136870: fix race in PyThreadState_Clear on sys_tracing_threads#136951

Merged
kumaraditya303 merged 1 commit intopython:mainpython/cpython:mainfrom
kumaraditya303:ts-clear-monitoringkumaraditya303/cpython:ts-clear-monitoringCopy head branch name to clipboard
Jul 21, 2025
Merged

gh-136870: fix race in PyThreadState_Clear on sys_tracing_threads#136951
kumaraditya303 merged 1 commit intopython:mainpython/cpython:mainfrom
kumaraditya303:ts-clear-monitoringkumaraditya303/cpython:ts-clear-monitoringCopy head branch name to clipboard

Conversation

@kumaraditya303
Copy link
Contributor

@kumaraditya303 kumaraditya303 commented Jul 21, 2025

In free-threading multiple threads can be cleared concurrently as such the modifications on sys_tracing_threads should be done while holding the profile lock otherwise it can race with other threads setting up profiling.

@ZeroIntensity
Copy link
Member

No news entry? This is fixing public APIs.

@kumaraditya303
Copy link
Contributor Author

kumaraditya303 commented Jul 21, 2025

No news entry? This is fixing public APIs.

I don't think news entries for data race fixes like this one are useful for user, we haven't been adding news for most of these changes unless it's a large change like fixing all races of a module.

@kumaraditya303 kumaraditya303 merged commit f183996 into python:main Jul 21, 2025
52 checks passed
@miss-islington-app
Copy link

Thanks @kumaraditya303 for the PR 🌮🎉.. 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 request Jul 21, 2025
…ng_threads` (pythonGH-136951)

In free-threading, multiple threads can be cleared concurrently as such the modifications on `sys_tracing_threads` should be done while holding the profile lock, otherwise it can race with other threads setting up profiling.
(cherry picked from commit f183996)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Jul 21, 2025

GH-136953 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jul 21, 2025
@kumaraditya303 kumaraditya303 deleted the ts-clear-monitoring branch July 21, 2025 20:39
kumaraditya303 added a commit that referenced this pull request Jul 21, 2025
…ing_threads` (GH-136951) (#136953)

gh-136870: fix data race in `PyThreadState_Clear` on `sys_tracing_threads` (GH-136951)

In free-threading, multiple threads can be cleared concurrently as such the modifications on `sys_tracing_threads` should be done while holding the profile lock, otherwise it can race with other threads setting up profiling.
(cherry picked from commit f183996)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
…ng_threads` (python#136951)

In free-threading, multiple threads can be cleared concurrently as such the modifications on `sys_tracing_threads` should be done while holding the profile lock, otherwise it can race with other threads setting up profiling.
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
…ng_threads` (python#136951)

In free-threading, multiple threads can be cleared concurrently as such the modifications on `sys_tracing_threads` should be done while holding the profile lock, otherwise it can race with other threads setting up profiling.
kumaraditya303 added a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
…s_tracing_threads` (pythonGH-136951) (python#136953)

pythongh-136870: fix data race in `PyThreadState_Clear` on `sys_tracing_threads` (pythonGH-136951)

In free-threading, multiple threads can be cleared concurrently as such the modifications on `sys_tracing_threads` should be done while holding the profile lock, otherwise it can race with other threads setting up profiling.
(cherry picked from commit f183996)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
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.

3 participants

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