Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/trace: go tool trace mishandles goroutine that extends beyond the current span. #21911
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
A little bit more detail and runtime scheduling related question:
From 1.73ms, the main goroutine gets P and until it's preempted around 1.43s, the only events generated from P is GC sweep events, heap allocation events, and a lot of GoCreate events.
1.730705ms 1730705 GoStart p=1 g=1 off=676 g=1 seq=0 link=off:19101341
I don't understand why runtime didn't preempt the main goroutine but allow it to occupy P for more than 1s. My guess is probably most goroutines are short-lived, so other 3 Ps are sufficient to
Going back to the limitation of the current execution tracer's visualization:
Due to the limitation of the chrome trace viewer that can't handle large size input, go execution tracer arbitrarily splits the trace based on the event timestamp into multiple chunks. In this case, the first chunk includes events that started within 0-256ms. The slice (the block in the viewer) that represents the period of time the main goroutine has the start time that is inside the chunk, but its end time is outside the chunk (256ms < 1.431362065s from the GoPreempt event), so the runtime.main slice was presented strangely here. The only events the runtime.main goroutine resulted in during this execution were GoCreate events but that events are represented as the arrows which will not show up unless "View Options" flow events box is selected.
One workaround is truncate the last slice so it ends at the end of the presented chunks. But that's a hack.