Skip to content

gh-137400: Fix thread-safety issues when profiling all threads#137518

Merged
colesbury merged 10 commits intopython:mainfrom
colesbury:gh-137400-now-with-fewer-crashes
Aug 13, 2025
Merged

gh-137400: Fix thread-safety issues when profiling all threads#137518
colesbury merged 10 commits intopython:mainfrom
colesbury:gh-137400-now-with-fewer-crashes

Conversation

@colesbury
Copy link
Copy Markdown
Contributor

@colesbury colesbury commented Aug 7, 2025

There were a few thread-safety issues when profiling or tracing all threads via PyEval_SetProfileAllThreads or PyEval_SetTraceAllThreads:

  • The loop over thread states could crash if a thread exits concurrently (in both the free threading and default build)
  • The modification of c_profilefunc and c_tracefunc wasn't thread-safe on the free threading build.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants