Skip to content
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

cmd/pprof: negative numbers in go tool pprof heap report in 1.22.3, but not in 1.22.2 #67584

Closed
ruz opened this issue May 22, 2024 · 4 comments
Closed
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@ruz
Copy link

ruz commented May 22, 2024

Go version

1.22.3

Output of go env in your module/workspace:

---

Not sure how to get it from env where docker image is built and where service is executed.

What did you do?

Took a heap profile from a running service (docker/k8s/linux) using instrumentation server opened on a dedicated port with built in pprof handlers. The service was built with 1.22.3. As far as I know all allocations tracking settings are at default values. Opened the profile using go tool pprof 1.22.3 on mac os. Got negatives all over, see screenshot.

Restarted service. Repeated experiment. Same result.

Built the service with 1.22.2. No negatives in the report.

In all experiments used 1.22.3 to view profiles.

Not sure I can provide more details, hope that it's easy to track regression in allocations tracking code.

sceenshot 2024-05-22 в 12 29 45

What did you see happen?

allocation report contained a lot of negative numbers

What did you expect to see?

report without negative "memory in use" numbers

@seankhliao
Copy link
Member

is it possible for you to show the profile?

@ruz
Copy link
Author

ruz commented May 22, 2024

I've tried to reproduce with a simple script that leaks goroutines and memory, but failed.

Hope somebody realize problem without me spending more time. If not then I will try to get around to it and cook some reproducible example. Not sure that I can publish profile as it is from a closed source project.

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels May 22, 2024
@seankhliao seankhliao changed the title Negative numbers in go tool pprof heap report in 1.22.3, but not in 1.22.2 cmd/pprof: negative numbers in go tool pprof heap report in 1.22.3, but not in 1.22.2 May 22, 2024
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label May 22, 2024
@nsrip-dd
Copy link
Contributor

Are you using the seconds query parameter? Something like /debug/pprof/heap?seconds=30? If so, it's possible to see negative values for the live heap sample values (inuse_space and inuse_objects). The seconds parameter gives the difference of two profiles collected that many seconds apart. If some memory was freed between when the profiles were collected, the values associated with some call stacks can be negative. Going off the example you shared, if there were open Broker connections when the first profile was collected, and they closed and their associated resources were freed by the time the second one was collected, it would be reasonable to see negative values for inuse_space and inuse_objects since there are fewer live allocations associated with the connections. As for the difference between 1.22.2 and 1.22.3, that could just be a coincidence. Perhaps memory usage happened to be increasing while you collected a profile running 1.22.2.

@gopherbot
Copy link
Contributor

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
Development

No branches or pull requests

4 participants