Skip to content

[3.13] gh-137400: Fix thread-safety issues when profiling all threads (gh-137518) #137733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: 3.13
Choose a base branch
from

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Aug 13, 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. (cherry picked from commit a10152f)

…hreads (pythongh-137518)

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.
(cherry picked from commit a10152f)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@Yhg1s
Copy link
Member

Yhg1s commented Aug 14, 2025

FYI, the ABI change seems fine to me.

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.

2 participants