aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime1.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2023-03-23 13:52:36 -0400
committerGopher Robot <gobot@golang.org>2023-03-24 18:49:58 +0000
commit5f882d82661db9f2d3d04924f67defe1732f24e2 (patch)
tree77b89c012c6a394f0132562d4fe1badfc3b63afa /src/runtime/runtime1.go
parentfba8566cda3a7ba8f32ed398466f1d95bb205594 (diff)
downloadgo-5f882d82661db9f2d3d04924f67defe1732f24e2.tar.xz
runtime: add GODEBUG=dontfreezetheworld=1
This GODEBUG flag disables the freezetheworld call during fatal panic. freezetheworld asks the scheduler to stop running goroutines on all Ms. This is normally useful, as it ensures we can collect a traceback from every goroutine. However, it can be frustrating when debugging the scheduler itself, as it significantly changes the scheduler state from when the panic started. Setting this flag has some disadvantages. Most notably, running goroutines will not traceback in the standard output (though they may be included in the final SIGQUIT loop). Additionally, we may missing concurrently created goroutines when looping over allgs (CL 270861 made this safe, but still racy). The final state of all goroutines will also be further removed from the time of panic, as they continued to run for a while. One unfortunate part of this flag is the final SIGQUIT loop in the runtime leaves every thread in the signal handler at exit. This is a bit frustrating in gdb, which doesn't understand how to step beyond sigtramp. The data is still there, but you must manually walk. Change-Id: Ie6bd3ac521fcababea668196b60cf225a0be1a00 Reviewed-on: https://go-review.googlesource.com/c/go/+/478975 Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/runtime1.go')
-rw-r--r--src/runtime/runtime1.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go
index 991b92a0af..02237685c7 100644
--- a/src/runtime/runtime1.go
+++ b/src/runtime/runtime1.go
@@ -309,6 +309,7 @@ type dbgVar struct {
var debug struct {
cgocheck int32
clobberfree int32
+ dontfreezetheworld int32
efence int32
gccheckmark int32
gcpacertrace int32
@@ -340,6 +341,7 @@ var dbgvars = []*dbgVar{
{name: "allocfreetrace", value: &debug.allocfreetrace},
{name: "clobberfree", value: &debug.clobberfree},
{name: "cgocheck", value: &debug.cgocheck},
+ {name: "dontfreezetheworld", value: &debug.dontfreezetheworld},
{name: "efence", value: &debug.efence},
{name: "gccheckmark", value: &debug.gccheckmark},
{name: "gcpacertrace", value: &debug.gcpacertrace},