golang / go

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

runtime: corrupted GoroutineProfile stack traces #69243

Closed felixge closed 1 month ago

felixge commented 2 months ago

A test case + fix for this issue is already submitted here: https://go-review.googlesource.com/c/go/+/609815

I'm opening this issue b/c it's a requirement for getting the fix back ported. cc @prattmic

Go version

go1.23.0

What did you do?

Received a bug report that my fgprof library broke in go1.23: https://github.com/felixge/fgprof/issues/33

What did you see happen?

Calling runtime.GoroutineProfile() repeatedly with the same input slice produced corrupted stack traces showing multiple runtime.goexit frames in the same stack trace.

2024-09-04 CleanShot at 09 29 31

What did you expect to see?

runtime.goexit should only show up in the root frame of the stack trace.

gabyhelp commented 2 months ago

Related Issues and Documentation

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

prattmic commented 2 months ago

@gopherbot Please backport to 1.23. This is a regression in goroutine profiles with no workaround.

gopherbot commented 2 months ago

Backport issue(s) opened: #69258 (for 1.23).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

gopherbot commented 2 months ago

Change https://go.dev/cl/609815 mentions this issue: runtime: fix GoroutineProfile stacks not getting null terminated

cagedmantis commented 1 month ago

Does the fix for #69335 need to be back-ported as well? It's part of the CL stack.

Edit: There's an answer to this question in https://github.com/golang/go/issues/69335#issuecomment-2389083382.