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 — gh-138122: Validate base frame before caching in remote debugging frame cache by pablogsal · Pull Request #142852 · python/cpython

Conversation

@pablogsal

@pablogsal pablogsal commented Dec 17, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

The frame cache in the remote debugging module was storing frame chains
without validating that they reached the base frame. This could happen
when a frame chain was interrupted or when the process state changed
during reading, resulting in incomplete stacks being cached. Subsequent
samples that hit the cache would then produce flamegraphs that didn't
reach the bottom of the call stack.

The fix passes base_frame_addr through to process_frame_chain() which
already has validation logic to ensure the frame walk terminates at the
expected sentinel frame. By enabling this validation in the caching code
path and tracking whether we've confirmed reaching the base frame, we
now only store complete frame chains in the cache. When extending from
cached data, we trust that the cached frames were already validated at
storage time, maintaining the invariant that cached stacks are always
complete.

An integration test using deeply nested generators that oscillate the
stack depth is added to verify that all sampled stacks contain the entry
point function. This catches regressions where incomplete stacks might
be cached and returned.

  • Issue: Implement PEP 799 – A dedicated profiling package for organizing Python profiling tools #138122

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added the awaiting core review label Dec 17, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Dec 17, 2025
Implement PEP 799 – A dedicated profiling package for organizing Python profiling tools #138122
Closed
@pablogsal
pablogsal force-pushed the tachyon-frame-cache branch 2 times, most recently from d3ffd62 to 224dede Compare December 17, 2025 03:11
@pablogsal pablogsal added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 17, 2025
@bedevere-bot

bedevere-bot commented Dec 17, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @pablogsal for commit 224dede 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F142852%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 17, 2025
pablogsal
pablogsal commented Dec 17, 2025
View reviewed changes
Comment thread Lib/test/test_profiling/test_sampling_profiler/test_integration.py Resolved

Uh oh!

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

pablogsal
pablogsal commented Dec 17, 2025
View reviewed changes
Comment thread Lib/test/test_profiling/test_sampling_profiler/test_integration.py Resolved

Uh oh!

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

pablogsal
pablogsal commented Dec 17, 2025
View reviewed changes
Comment thread Lib/test/test_profiling/test_sampling_profiler/test_integration.py Resolved

Uh oh!

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

@pablogsal pablogsal added type-bug An unexpected behavior, bug, or error and removed awaiting core review labels Dec 17, 2025
pablogsal
pablogsal commented Dec 17, 2025
View reviewed changes
Comment thread Lib/test/test_profiling/test_sampling_profiler/test_integration.py Resolved

Uh oh!

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

pablogsal
pablogsal commented Dec 17, 2025
View reviewed changes
Comment thread Lib/test/test_profiling/test_sampling_profiler/test_integration.py Resolved

Uh oh!

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

@pablogsal
pablogsal force-pushed the tachyon-frame-cache branch 4 times, most recently from 2da04f7 to f31e71d Compare December 17, 2025 13:12
@pablogsal
pythongh-138122: Validate base frame before caching in remote debuggi…
2cd7686
…ng frame cache

The frame cache in the remote debugging module was storing frame chains
without validating that they reached the base frame. This could happen
when a frame chain was interrupted or when the process state changed
during reading, resulting in incomplete stacks being cached. Subsequent
samples that hit the cache would then produce flamegraphs that didn't
reach the bottom of the call stack.

The fix passes base_frame_addr through to process_frame_chain() which
already has validation logic to ensure the frame walk terminates at the
expected sentinel frame. By enabling this validation in the caching code
path and tracking whether we've confirmed reaching the base frame, we
now only store complete frame chains in the cache. When extending from
cached data, we trust that the cached frames were already validated at
storage time, maintaining the invariant that cached stacks are always
complete.

An integration test using deeply nested generators that oscillate the
stack depth is added to verify that all sampled stacks contain the entry
point function. This catches regressions where incomplete stacks might
be cached and returned.
@pablogsal
pablogsal force-pushed the tachyon-frame-cache branch from f31e71d to 2cd7686 Compare December 17, 2025 14:06
@pablogsal pablogsal added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 17, 2025
@bedevere-bot

bedevere-bot commented Dec 17, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @pablogsal for commit 2cd7686 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F142852%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 17, 2025
@pablogsal
pablogsal merged commit 568a819 into python:main Dec 17, 2025
76 of 79 checks passed

Uh oh!

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

@pablogsal
pablogsal deleted the tachyon-frame-cache branch December 17, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

type-bug An unexpected behavior, bug, or error

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

@pablogsal @bedevere-bot
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.