Skip to content

[3.13] gh-137400: Fix a crash when disabling profiling across all threads (gh-137471) #137649

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

Merged
merged 1 commit into from
Aug 11, 2025

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Aug 11, 2025

The PyEval_SetProfileAllThreads function and other related functions had a race condition on tstate->c_profilefunc that could lead to a crash when disable profiling or tracing on all threads while another thread is starting to profile or trace a a call.

There are still potential crashes when threads exit concurrently with profiling or tracing be enabled/disabled across all threads.
(cherry picked from commit 3626928)

…ll threads (pythongh-137471)

The `PyEval_SetProfileAllThreads` function and other related functions
had a race condition on `tstate->c_profilefunc` that could lead to a
crash when disable profiling or tracing on all threads while another
thread is starting to profile or trace a a call.

There are still potential crashes when threads exit concurrently with
profiling or tracing be enabled/disabled across all threads.
(cherry picked from commit 3626928)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@colesbury colesbury enabled auto-merge (squash) August 11, 2025 15:46
@colesbury colesbury merged commit e236568 into python:3.13 Aug 11, 2025
40 checks passed
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.

1 participant