You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run a program with GOTRACEBACK=crash where some of the threads are on the system stack. This was observed in the go1.8.txt traceback from https://groups.google.com/d/topic/golang-dev/PVwDFD7gDuk/discussion. It can be reproduced by running the following program with GOGC=1 GOTRACEBACK=crash and sending it SIGQUIT (it may take a few tries since it's timing-dependent):
package main
import (
"runtime""time"
)
varslice=make([]*byte, 16<<20)
varballast=mkTree(10)
varsinkinterface{}
funcmain() {
constcount=4runtime.GOMAXPROCS(count+1)
// Get the garbage collector going so typedslicecopy switches// to the system stack. We have to do this before starting// loop since GC won't be able to start once we're in loop.gofunc() {
for {
sink=make([]byte, 16<<20)
}
}()
time.Sleep(10*time.Millisecond)
fori:=0; i<count; i++ {
goloop(i)
}
select {}
}
funcloop(iint) {
for {
forj:=0; j<0x7fffffff; j++ {
// This runs on the system stack when GC is active.copy(slice, slice[1:])
}
}
}
typenodestruct {
l, r*node
}
funcmkTree(depthint) *node {
ifdepth<=0 {
returnnil
}
return&node{mkTree(depth-1), mkTree(depth-1)}
}
What did you expect to see?
A traceback with the full stacks of all goroutines in loop.
What did you see instead?
When a loop goroutine is on the system stack when the traceback happens, we only see the system stack part:
…ing GOTRACBEACK=crash
Currently, when printing tracebacks of other threads during
GOTRACEBACK=crash, if the thread is on the system stack we print only
the header for the user goroutine and fail to print its stack. This
happens because we passed the g0 to traceback instead of curg. The g0
never has anything set in its gobuf, so traceback doesn't print
anything.
Fix this by passing _g_.m.curg to traceback instead of the g0.
Fixes#19494.
Fixes#19637 (backport).
Change-Id: Idfabf94d6a725e9cdf94a3923dead6455ef3b217
Reviewed-on: https://go-review.googlesource.com/39600
Run-TryBot: Austin Clements <[email protected]>
Reviewed-by: Russ Cox <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
What version of Go are you using (
go version
)?go version go1.8 linux/amd64
What did you do?
Run a program with GOTRACEBACK=crash where some of the threads are on the system stack. This was observed in the
go1.8.txt
traceback from https://groups.google.com/d/topic/golang-dev/PVwDFD7gDuk/discussion. It can be reproduced by running the following program withGOGC=1 GOTRACEBACK=crash
and sending it SIGQUIT (it may take a few tries since it's timing-dependent):What did you expect to see?
A traceback with the full stacks of all goroutines in
loop
.What did you see instead?
When a
loop
goroutine is on the system stack when the traceback happens, we only see the system stack part:The text was updated successfully, but these errors were encountered: