-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
runtime/pprof: doesn't dump goroutine labels when stacks collected #63712
Comments
Thank you for the report. Looks like debug=0 and debug=1 worked with Go 1.18 and stopped working with Go 1.19. Looks like debug=2 may never have worked?
It looks to me like this was true for Go 1.18, but is no longer the case. Do you see it working now @xaurx , with go1.21.3? https://go.dev/play/p/BkLFOW46oiO
|
@rhysh thanks for so fast reply. Seems you faced another "bug"... if you add go pprof.Do(context.Background(), pprof.Labels("key123", "val456_VALUE_IS_HERE"), func(ctx context.Context) { time.Sleep(time.Hour) }) you will notice it starts to work with debug=1 (https://go.dev/play/p/lgGnPLuSN1Z). |
Unfortunately legacy format is more helpful in debug as it dumps goroutine labels. 'gops stack' doesn't dump them. Golang issue: golang/go#63712
Here's some previous discussion of "include labels in debug=2 goroutine profile", but it's mixed in with discussions of adding labels to other profiles: #23458 (comment) . I don't see an issue specifically for that request / proposal. @mknyszek might have more context paged in on what obstacles we might need to overcome to make that happen. Yes, I see now that with debug=0 and debug=1, the labels are missing only from the single goroutine that captures the profile. (The finalizer goroutine gets some other special handling, which is working properly.) https://go.dev/play/p/YTkp_laHyly I'll send a CL to repair that and add the missing test. CC @mknyszek @golang/runtime |
Change https://go.dev/cl/537515 mentions this issue: |
The goroutine profile has close to three code paths for adding a goroutine record to the goroutine profile: one for the goroutine that requested the profile, one for every other goroutine, plus some special handling for the finalizer goroutine. The first of those captured the goroutine stack, but neglected to include that goroutine's labels. Update the tests to check for the inclusion of labels for all three types of goroutines, and include labels for the creator of the goroutine profile. For #63712 Change-Id: Id5387a5f536d3c37268c240e0b6db3d329a3d632 Reviewed-on: https://go-review.googlesource.com/c/go/+/537515 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Auto-Submit: Rhys Hiltner <[email protected]> Reviewed-by: David Chase <[email protected]>
@rhysh Is this fixed as of https://go.dev/cl/537515? Closing optimistically; let me know if we should reopen. |
@mknyszek I understood this to be a feature request, asking that goroutine labels be included in the debug=2 output. Then while trying to understand the request, I accidentally discovered a bug with debug=0 and =1 which I fixed with CL 537515 — but the original feature request remains unaddressed. I think we should reopen the issue, thanks.
|
Got it, misunderstood. Thanks! |
Any chance this to be fixed as it's very important to be able to see labels on goroutines for debugging? Thanks! |
What version of Go are you using (
go version
)?What did you do?
when collecting all goroutine call traces for debug purposes (e.g. using gops tool) one expects to see labels associated with goroutines. However, writeGoroutine() with debug>=2 which calls writeGoroutineStacks() do not provide them.
Yet legacy call traces provided with debug<2 in call like this:
provide goroutine labels.
What did you expect to see?
goroutines stacks with labels.
What did you see instead?
goroutines stacks without labels.
The text was updated successfully, but these errors were encountered: