runtime/pprof: block/mutex profile stacks can sometimes miss leaf frames #69747
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.
Milestone
Go version
go version go1.23.1 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Built this program with PGO and ran it:
What did you see happen?
If I build with PGO using a profile where
runtime.blockevent
is hot, then I see this output:Example program which generates such a CPU profile:
What did you expect to see?
I expected to see
chanrecv1
in the root frame:I see that if I run the program with frame pointer unwinding disabled (
GODEBUG=tracefpunwindoff=1
) or if I run it with Go 1.22.The problem is that if
runtime.saveblockevent
is inlined intoruntime.blockevent
, thengetfp()
will return one ofruntime.saveblockevent
's callers frame pointers here, andruntime.fpTracebackPartialExpand
will start frame pointer unwinding from the wrong frame, making the skip values incorrect. Depending on how much inlining there is, we might see even more missing frames.The text was updated successfully, but these errors were encountered: