golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.29k stars 17.7k forks source link

cmd/trace: show end stack traces #70570

Open felixge opened 10 hours ago

felixge commented 10 hours ago

Go version

go version devel go1.24-733df2bc0a 2024-11-25 02:23:41 +0000 darwin/arm64

Output of go env in your module/workspace:

n/a

What did you do?

I generated an execution trace for a simple Go program that has a single goroutine that runs for 10ms on CPU followed by 10ms of sleep in a loop.

What did you see happen?

Clicking on the first three goroutine spans, I see:

Showing only the start stack traces also makes it impossible to see the last stack trace produced by a goroutine.

What did you expect to see?

Showing both start and end stack traces would make it much easier to understand the trace:

update: I realized this is not just a "nice to have" but actually a regression compared to go1.22, see comment below.

cc @mknyszek @prattmic @nsrip-dd - CL for this is submitted below

gabyhelp commented 10 hours ago

Related Issues

Related Code Changes

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

gopherbot commented 9 hours ago

Change https://go.dev/cl/631895 mentions this issue: cmd/trace: also show end stack traces

felixge commented 6 hours ago

I just realized that this also seems to be a regression compared to go1.22. It seems like the old behavior was to always show the end stack trace, and only to show the start stack trace when the goroutine was created (?), see screenshots below. (I re-executed the program in go1.22, but the 3rd screenshot also shows a span that was preceeded by a short execution that got preempted).

So maybe the case can be made to include this into go1.24 despite the freeze and potentially even a backport to go1.23?

GoVeronicaGo commented 3 hours ago

cc: @golang/runtime

prattmic commented 2 hours ago

Since this is a regression and very simple, I personally think it would be OK to backport.