]> Cypherpunks repositories - gostls13.git/commit
cmd/trace: don't filter events for profile by whether they have stack
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 7 Aug 2025 18:53:00 +0000 (18:53 +0000)
committerMichael Knyszek <mknyszek@google.com>
Thu, 4 Sep 2025 18:12:32 +0000 (11:12 -0700)
commit00b8474e47a1f0381170734604a7ce8123d7146d
treecc4494ceeb0ceb5e8f43d717b1784d9893a0565f
parente36c5aead681d8264f1fac725f2a15c1ca2b895a
cmd/trace: don't filter events for profile by whether they have stack

Right now the profile-from-trace code blindly discards events that don't
have a stack, but this means it can discard 'end' events for goroutine
time ranges that don't have stacks, like when a goroutine exits a
syscall. This means we drop stack samples we *do* have, because we
correctly already only use the stack trace of the corresponding 'start'
event for a time-range-of-interest anyway.

This change means that some events will be tracked that have no stack in
their start event, but that's fine. It won't end up in the profile
anyway because the stack is empty! And the rest of the code appears to
be robust to an empty stack already.

Thank you to Rhys Hiltner for reporting this issue and for the
reproducer, which I have worked into a test for this change.

Fixes #74850.

Change-Id: I943b97ecf6b82803e4a778a0f83a14473d32254e
Reviewed-on: https://go-review.googlesource.com/c/go/+/694156
Reviewed-by: Rhys Hiltner <rhys.hiltner@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
src/cmd/trace/pprof.go
src/cmd/trace/pprof_test.go [new file with mode: 0644]
src/go/build/deps_test.go
src/internal/trace/testtrace/platforms.go [new file with mode: 0644]