GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.14] gh-137400: Fix thread-safety issues when profiling all threads (gh-137518) by colesbury · Pull Request #137730 · python/cpython

Conversation

@colesbury

@colesbury colesbury commented Aug 13, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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)

  • Issue: sys._setprofileallthreads race condition #137400

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@colesbury
[3.14] pythongh-137400: Fix thread-safety issues when profiling all t…
a4b3a4b
…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 <[email protected]>
@colesbury
colesbury requested review from ericsnowcurrently and markshannon as code owners August 13, 2025 18:33
@bedevere-app bedevere-app Bot added the awaiting core review label Aug 13, 2025
@colesbury colesbury self-assigned this Aug 13, 2025
This was referenced Aug 13, 2025
sys._setprofileallthreads race condition #137400
Closed
gh-137400: Fix thread-safety issues when profiling all threads #137518
Merged
@colesbury

colesbury commented Aug 13, 2025

Copy link
Copy Markdown
Contributor Author

This can wait until 3.14.1

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@colesbury
Restore sys_trace_profile_mutex field
cb2b783
@colesbury colesbury mentioned this pull request Sep 16, 2025
[3.14] gh-137433: Fix deadlock with stop-the-world and daemon threads (gh-137735) #138965
Merged
@encukou
Merge branch '3.14' into backport-a10152f-3.14
fba255e
@colesbury
colesbury merged commit fb699ef into python:3.14 Oct 7, 2025
5 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@colesbury
colesbury deleted the backport-a10152f-3.14 branch October 7, 2025 17:45
@bedevere-app bedevere-app Bot removed the awaiting core review label Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@colesbury colesbury

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@colesbury @encukou
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.