From dac0220841a44815584c83d26e9f9a45f5560f6d Mon Sep 17 00:00:00 2001 From: "Paul E. Murphy" Date: Thu, 9 Dec 2021 16:09:24 -0600 Subject: [PATCH] runtime: avoid potential hang in TestGdbAutotmpTypes If a GC related task preempts between hitting the main.main breakpoint and stepping, the test program may halt forever waiting on a GC operation. This happens if gdb is configured to halt other threads while executing a step. Configure gdb to continue running all threads during a step by setting the scheduler-locking option to off. Fixes #49852 Change-Id: Iacc9732cbd23526bde0a295e6fa8a0d90f733f59 Reviewed-on: https://go-review.googlesource.com/c/go/+/370775 Reviewed-by: Michael Knyszek Run-TryBot: Paul Murphy TryBot-Result: Gopher Robot Reviewed-by: Cherry Mui Trust: Cherry Mui --- src/runtime/runtime-gdb_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go index bb76116ee90..063b9a7d452 100644 --- a/src/runtime/runtime-gdb_test.go +++ b/src/runtime/runtime-gdb_test.go @@ -500,6 +500,10 @@ func TestGdbAutotmpTypes(t *testing.T) { args := []string{"-nx", "-batch", "-iex", "add-auto-load-safe-path " + filepath.Join(testenv.GOROOT(t), "src", "runtime"), "-ex", "set startup-with-shell off", + // Some gdb may set scheduling-locking as "step" by default. This prevents background tasks + // (e.g GC) from completing which may result in a hang when executing the step command. + // See #49852. + "-ex", "set scheduler-locking off", "-ex", "break main.main", "-ex", "run", "-ex", "step",