gh-137400: Fix a crash when disabling profiling across all threads#137471
gh-137400: Fix a crash when disabling profiling across all threads#137471colesbury merged 1 commit intopython:mainfrom
Conversation
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.
|
|
|
🤖 New build scheduled with the buildbot fleet by @colesbury for commit 5e5e4f1 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F137471%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
|
Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…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>
|
Sorry, @colesbury, I could not cleanly backport this to |
|
GH-137648 is a backport of this pull request to the 3.14 branch. |
…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>
|
GH-137649 is a backport of this pull request to the 3.13 branch. |
…eads (gh-137471) (gh-137649) 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)
|
|
* main: pythongh-137288: Update 3.14 magic numbers (pythonGH-137665) pythongh-135228: When @DataClass(slots=True) replaces a dataclass, make the original class collectible (take 2) (pythonGH-137047) pythongh-126008: Improve docstrings for Tkinter cget and configure methods (pythonGH-133303) pythongh-131885: Use positional-only markers for ``max()`` and ``min()`` (python#131868) pythonGH-137426: Remove code deprecation of `importlib.abc.ResourceLoader` (pythonGH-137567) pythongh-125897: Mark range function parameters as positional only (python#125945) pythongh-137400: Fix a crash when disabling profiling across all threads (pythongh-137471) pythongh-115766: Fix IPv4Interface.is_unspecified (pythonGH-137326) pythongh-128813: cleanup C-API docs for PyComplexObject (pythonGH-137579) pythongh-135953: Profile a module or script with sampling profiler (python#136777) Fix documentation of hash in PyHash_FuncDef (python#137595)
|
(These were temporary failures, fixed by a buildbot restart: #137186 (comment)) |
…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.
…ll threads (pythongh-137471) (python#137648) Co-authored-by: Sam Gross <colesbury@gmail.com>
The
PyEval_SetProfileAllThreadsfunction and other related functions had a race condition ontstate->c_profilefuncthat 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.
sys._setprofileallthreadsrace condition #137400