-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
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:
runtime: invalid pc-encoded table f=runtime/pprof.addMaxRSS pc=0x59145d targetpc=0x59145f tab=[0/0]0x0
value=-1 until pc=0x59143c
value=0 until pc=0x591443
value=-1 until pc=0x59145d
fatal error: invalid runtime symbol table
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