-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: heap profile is blank on go1.23rc1 (go1.22.4 was ok) #68136
Comments
Right now this issue isn't very actionable with the lack of information: what were the exact steps you took to generate the profile? what does blank mean? do you have a standalone reproducer? can we see the profile? |
I can share profile for go1.23rc1, here it is. it is only 231 bytes @seankhliao
|
How was it created? |
by calling runtime/pprof.writeHeap directly from my application @seankhliao |
Note: I could only get this to reproduce on very simple programs, doing anything more such as dual writing through |
Why is the profile entirely "<unknown>"? What is your total heap size? Can you post the non-empty profile as well? |
I am not sure profile from modified version of go1.23rc1 or go1.22.4 benefit anything here. |
btw, this is the temporary patch I applied to go1.23rc1 to get previous behavior back for pprof and also temporarily modified goroutineProfileWithLabelsConcurrent to get unknowns labels to proper one. Some might not related, but this is what I have now. |
okay, seems like I understand the issue and what was changed in go1.23rc1 when I put you may close the issue, if it is working as expected. @rsc @seankhliao |
This is actually a real bug. Thanks @S-YOU for reporting. |
Change https://go.dev/cl/596538 mentions this issue: |
Thank you very much the for the fix @cherrymui, didn't realize that its been optimized out. |
…is used We have an optimization that if the memory profile is not consumed anywhere, we set the memory profiling rate to 0 to disable the "background" low-rate profiling. We detect whether the memory profile is used by checking whether the runtime.MemProfile function is reachable at link time. Previously, all APIs that access the memory profile go through runtime.MemProfile. But the code was refactored in CL 572396, and now the legacy entry point WriteHeapProfile uses pprof_memProfileInternal without going through runtime.MemProfile. In fact, even with the recommended runtime/pprof.Profile API (pprof.Lookup or pprof.Profiles), runtime.MemProfile is only (happen to be) reachable through countHeap. Change the linker to check runtime.memProfileInternal instead, which is on all code paths that retrieve the memory profile. Add a test case for WriteHeapProfile, so we cover all entry points. Fixes golang#68136. Change-Id: I075c8d45c95c81825a1822f032e23107aea4303c Reviewed-on: https://go-review.googlesource.com/c/go/+/596538 Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Go version
go1.23rc1
Output of
go env
in your module/workspace:What did you do?
Taking heap profile for my application using heap profile from runtime package
What did you see happen?
heap profile shows nothing (it was ok in go1.22.4)
What did you expect to see?
show something in heap profile
The text was updated successfully, but these errors were encountered: