-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: runtime_expandFinalInlineFrame doesn't skip trailing wrappers #58288
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
Comments
Thanks, good catch. Would you like to send that patch as a CL yourself? |
CC @golang/runtime |
For profile, maybe we want to always include the wrapper frame, so it matches more closely to what actually happened at runtime? Not sure if this can be done easily with the current structure. |
Even if so, |
I agree that |
Change https://go.dev/cl/465097 mentions this issue: |
The existing runtime_expandFinalInlineFrame implementation doesn't skip trailing wrappers, but gentraceback does skip wrapper functions. This change makes runtime_expandFinalInlineFrame handling wrapper functions consistent to gentraceback. Fixes golang#58288 Change-Id: I1b0e2c10b0a89bcb1e787b98d27730cb40a34406 Reviewed-on: https://go-review.googlesource.com/c/go/+/465097 Reviewed-by: Michael Pratt <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Michael Pratt <[email protected]> Run-TryBot: Michael Pratt <[email protected]> Reviewed-by: David Chase <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I noticed an inconsistency in handling inline wrapper functions between
runtime_expandFinalInlineFrame
andgentraceback
.gentraceback
ignores a wrapper function with an inlined function andruntime_expandFinalInlineFrame
does not ignore and append to stacktrace. Because of thatprofileBuilder.appendLocsForStack
may emit different locations for exactly the same stack, depending on the order of processed records. For example if a builder sees a wrapped function for the first time as a last item in the stack, it will be expanded with an extra pc of a wrapped function and emit a location with two functions. At the same time if a builder sees a wrapped function for the first time in the middle of the stack, it will emit a location with one function.In order to reproduce the issue with pprof profiles you need to have a profile sample with a stacktrace ending(truncated) with a wrapper function(for example a heap profile with a stack[31] pointing to a wrapped inlined function).
An easier way to reproduce the inconsistency calling
runtime_expandFinalInlineFrame
directly:https://go.dev/play/p/FW8j4zXCrqN
What did you expect to see?
What did you see instead?
Possible fix
CC @prattmic
The text was updated successfully, but these errors were encountered: