Skip to content

Conversation

@tbg
Copy link
Member

@tbg tbg commented Jan 9, 2026

Backport 1/1 commits from #160608 on behalf of @tbg.


Previously, when requesting profiles like allocs, heap, block, or mutex through the pprof UI endpoint (/debug/pprof/ui/allocs/?seconds=10), the seconds parameter was ignored and an immediate snapshot was returned. This differed from the behavior of Go's standard pprof handler at /debug/pprof/allocs?seconds=10, which correctly collected a delta profile over the specified duration.

The issue was in profileLocal() which handled these profile types in the default case without respecting req.Seconds. Now, when Seconds > 0 is specified, we collect two profile snapshots separated by the requested duration and compute their difference (delta profile) using the same algorithm as Go's net/http/pprof: scale the first profile by -1 and merge with the second.

This enables the pprof UI to show "recent allocations" over a specific time window rather than cumulative allocations since process start.

Release note (bug fix): Fixed a bug where the pprof UI endpoints for allocs, heap, block, and mutex profiles ignored the seconds parameter and returned immediate snapshots instead of delta profiles.

Epic: none


Release justification: fixes and slightly extends a useful isolated expert debugging observability feature.

Previously, when requesting profiles like allocs, heap, block, or mutex
through the pprof UI endpoint (/debug/pprof/ui/allocs/?seconds=10), the
seconds parameter was ignored and an immediate snapshot was returned.
This differed from the behavior of Go's standard pprof handler at
/debug/pprof/allocs?seconds=10, which correctly collected a delta
profile over the specified duration.

The issue was in profileLocal() which handled these profile types in
the default case without respecting req.Seconds. Now, when Seconds > 0
is specified, we collect two profile snapshots separated by the
requested duration and compute their difference (delta profile) using
the same algorithm as Go's net/http/pprof: scale the first profile
by -1 and merge with the second.

This enables the pprof UI to show "recent allocations" over a specific
time window rather than cumulative allocations since process start.

Release note (bug fix): Fixed a bug where the pprof UI endpoints for
allocs, heap, block, and mutex profiles ignored the seconds parameter
and returned immediate snapshots instead of delta profiles.
@tbg tbg requested a review from a team as a code owner January 9, 2026 22:22
@tbg tbg requested review from kyle-a-wong and removed request for a team January 9, 2026 22:22
@blathers-crl blathers-crl bot added blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. labels Jan 9, 2026
@blathers-crl
Copy link

blathers-crl bot commented Jan 9, 2026

Thanks for opening a backport.

Before merging, please confirm that the change does not break backwards compatibility and otherwise complies with the backport policy. Include a brief release justification in the PR description explaining why the backport is appropriate. All backports must be reviewed by the TL for the owning area. While the stricter LTS policy does not yet apply, please exercise judgment and consider gating non-critical changes behind a disabled-by-default feature flag when appropriate.

@blathers-crl blathers-crl bot added backport Label PR's that are backports to older release branches T-admission-control Admission Control labels Jan 9, 2026
@blathers-crl
Copy link

blathers-crl bot commented Jan 9, 2026

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tbg tbg merged commit 1353f2e into cockroachdb:release-26.1 Jan 15, 2026
17 checks passed
@tbg tbg deleted the blathers/backport-release-26.1-160608 branch January 15, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Label PR's that are backports to older release branches blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. T-admission-control Admission Control target-release-26.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants