-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: lostProfileEvent stack breaks gentraceback guarantee #38096
Comments
Change https://golang.org/cl/225661 mentions this issue: |
It looks like this could affect 1.14.1. lostProfileEvent is preceded by scaleMutexProfile, which inlines runtime.SetMaxProfileRate:
I'll send a cherry-pick request (though, per above, I think we want either way). |
@gopherbot, please open a backport issue for 1.14. |
Backport issue(s) opened: #38118 (for 1.14). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
gentraceback generates PCs which are usually following the CALL instruction. For those that aren't, it fixes up the PCs so that functions processing the output can unconditionally decrement the PC. See https://github.com/golang/go/blob/master/src/runtime/traceback.go#L343-L355.
When generating a fake "lost profile event" stack (https://github.com/golang/go/blob/master/src/runtime/pprof/proto.go#L325), addCPUData fails to meet this requirement, as lostProfileEvent-1 will land in the function preceeding lostProfileEvent.
#37447 exposes this bug as problematic. If the function preceeding lostProfileEvent contains inlined functions, then runtime_expandInlineFrames will panic when it tries to lookup the PC in the wrong function. Something like:
At HEAD, this isn't a problem because runtime/pprof.addMaxRSS precedes lostProfileEvent and contains no inlined calls, thus runtime_expandInlineFrames short-circuits. N.B., I modified addMaxRSS to add an inlined call for the panic above.
I'll need to double check if this is a problem for 1.14.1, but even if not, we probably want to patch 1.14.2, as subtle build order changes could break things.
cc @randall77 @heschik @hyangah
The text was updated successfully, but these errors were encountered: