[3.14] gh-137400: Fix a crash when disabling profiling across all threads (gh-137471) by miss-islington · Pull Request #137648 · python/cpython · GitHub
Skip to content

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

Merged
hugovk merged 1 commit into
python:3.14from
miss-islington:backport-3626928-3.14
Aug 12, 2025
Merged

hugovk merged 1 commit into
python:3.14from
miss-islington:backport-3626928-3.14

Conversation

@miss-islington

@miss-islington miss-islington commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

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

…ads (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

Copy link
Copy Markdown
Contributor

@hugovk

hugovk commented Aug 12, 2025

Copy link
Copy Markdown
Member

@hugovk
hugovk merged commit 4ebd928 into python:3.14 Aug 12, 2025
84 of 86 checks passed
kumaraditya303 pushed a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
…ll threads (pythongh-137471) (python#137648)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@miss-islington
miss-islington deleted the backport-3626928-3.14 branch January 2, 2026 18:01
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.

4 participants