File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,11 @@ type profiler struct {
8181 selfFrame * runtime.Frame
8282}
8383
84+ // nullTerminationWorkaround deals with a regression in go1.23, see:
85+ // - https://github.com/felixge/fgprof/issues/33
86+ // - https://go-review.googlesource.com/c/go/+/609815
87+ var nullTerminationWorkaround = runtime .Version () == "go1.23.0"
88+
8489// GoroutineProfile returns the stacks of all goroutines currently managed by
8590// the scheduler. This includes both goroutines that are currently running
8691// (On-CPU), as well as waiting (Off-CPU).
@@ -107,6 +112,11 @@ func (p *profiler) GoroutineProfile() []runtime.StackRecord {
107112 // p.stacks dynamically as well, but let's not over-engineer this until we
108113 // understand those cases better.
109114 for {
115+ if nullTerminationWorkaround {
116+ for i := range p .stacks {
117+ p .stacks [i ].Stack0 = [32 ]uintptr {}
118+ }
119+ }
110120 n , ok := runtime .GoroutineProfile (p .stacks )
111121 if ! ok {
112122 p .stacks = make ([]runtime.StackRecord , int (float64 (n )* 1.1 ))
You can’t perform that action at this time.
0 commit comments