mirror of
https://github.com/golang/go
synced 2024-11-26 06:38:00 -07:00
internal/trace: use the correct stack for goroutine naming in v2 traces
Currently goroutine names are determined (for v2 traces) by internal/tracev/2.Event.Stack, but this is wrong in general. For example, if we end up seeing a transition from GoNotExist->GoRunnable (goroutine creation) then we're taking the stack from the creator, not the created goroutine (which is what we're naming at that point). Use the StateTransition.Stack instead. This is always the correct one to use because we're always naming the goroutine that the state transition is for. Change-Id: I3fc7c8e4f85dfee3802d666c0c091b6953c7d6cf Reviewed-on: https://go-review.googlesource.com/c/go/+/544317 Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
450ecbe905
commit
351d8520a6
@ -318,10 +318,12 @@ func (b *goroutineStatsBuilder) event(ev tracev2.Event) {
|
||||
}
|
||||
}
|
||||
|
||||
// The goroutine hasn't been identified yet. Take any stack we
|
||||
// can get and identify it by the bottom-most frame of that stack.
|
||||
// The goroutine hasn't been identified yet. Take the transition stack
|
||||
// and identify the goroutine by the bottom-most frame of that stack.
|
||||
// This bottom-most frame will be identical for all transitions on this
|
||||
// goroutine, because it represents its immutable start point.
|
||||
if g.PC == 0 {
|
||||
stk := ev.Stack()
|
||||
stk := st.Stack
|
||||
if stk != tracev2.NoStack {
|
||||
var frame tracev2.StackFrame
|
||||
var ok bool
|
||||
|
Loading…
Reference in New Issue
Block a user