Skip to content

cmd/trace/v2: pprof profiles always empty [1.22 backport] #68546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gopherbot opened this issue Jul 22, 2024 · 6 comments
Closed

cmd/trace/v2: pprof profiles always empty [1.22 backport] #68546

gopherbot opened this issue Jul 22, 2024 · 6 comments
Labels
CherryPickApproved Used during the release process for point releases
Milestone

Comments

@gopherbot
Copy link
Contributor

@rhysh requested issue #68542 to be considered for backport to the next 1.22 minor release.

@gopherbot please backport to Go 1.22. The impact is limited to local runs of go tool trace, but there's no workaround. And since the change only affects go tool trace, it's relatively low risk.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Jul 22, 2024
@gopherbot gopherbot added this to the Go1.22.6 milestone Jul 22, 2024
@gopherbot
Copy link
Contributor Author

Change https://go.dev/cl/600255 mentions this issue: cmd/trace/v2: handle the -pprof flag

@gopherbot
Copy link
Contributor Author

Change https://go.dev/cl/600275 mentions this issue: cmd/trace/v2: make the -pprof actually useful

@dmitshur
Copy link
Contributor

This problem doesn't affect Go 1.21, only 1.22, because it's related to https://go.dev/doc/go1.22#trace changes, is that right?

@rhysh
Copy link
Contributor

rhysh commented Jul 22, 2024

That's how I understand it, yes.

With a trace generated by a go1.21.12 program, go tool trace -pprof=sched works with go1.21.12, go1.22.5, and go1.23rc2.

With a trace generated by a go1.22.5 program, go tool trace -pprof=sched works with go1.23rc2 but does not work with go1.22.5. (The format is too new for go1.21.12 to attempt to decode.)

So it's a problem with v2 traces (Go 1.22+) being read by the go1.22.x version of go tool trace.

@dmitshur dmitshur added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Jul 24, 2024
@dmitshur
Copy link
Contributor

We reviewed in a meeting and agreed to backport this. Thanks.

gopherbot pushed a commit that referenced this issue Jul 24, 2024
Turns out we ported all the profile generation, but forgot to actually
support the command line flags for them! This change fixes the issue by
handling the different kinds of profiles and writing them out to stdout.

For #66782
For #68542
For #68546

Change-Id: I7756fb4636ce8daaf11ed471be79c86ce3d463cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/578318
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit e14aad1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/600255
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
@gopherbot
Copy link
Contributor Author

Closed by merging CL 600255 (commit 2c88c1d) to release-branch.go1.22.

gopherbot pushed a commit that referenced this issue Jul 24, 2024
In both the v1 and v2 cmd/trace, pprofMatchingGoroutines will generate
no output at all if the filter name passed to it is the empty string.

This is rather pointless because there are at least two places where we
don't pass a name to filter. Modify pprofMatchingGoroutines to include
*all* goroutines in the trace if the name to filter by is not specified.

For #66782
Fixes #68542
Fixes #68546

Change-Id: I6b72298d676bc93892b075a7426e6e56bc6656c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/578356
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
(cherry picked from commit d1f2cd8)
Reviewed-on: https://go-review.googlesource.com/c/go/+/600275
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved Used during the release process for point releases
Projects
None yet
Development

No branches or pull requests

3 participants