]> Cypherpunks repositories - gostls13.git/commit
runtime: disable GC in TestPanicSystemstack's subprocess
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 5 Nov 2021 23:47:51 +0000 (23:47 +0000)
committerMichael Knyszek <mknyszek@google.com>
Mon, 8 Nov 2021 16:44:18 +0000 (16:44 +0000)
commit7bda349c1735fb6043b22d7a0e4542134baa6518
treef230f7a211e40d01ced5ec21c47634286c96439f
parent7ee3f1427b079bb363689321b0565ba7b03de03e
runtime: disable GC in TestPanicSystemstack's subprocess

TestPanicSystemstack spins up a subprocess that has 2 goroutines
deadlock on a runtime lock while on the system stack, with GOMAXPROCS=2.

Each goroutine is going to be running on a P, and then is going to wedge
itself up on that P.

If a GC is active and a worker starts executing (using a P), then it
could try to preempt a goroutine that is already blocked. It won't be
able to, so it'll just sit there forever trying to suspend it. At this
point there are no more Ps to execute the remaining goroutine that needs
to print something so the parent process can continue the test.

This change fixes this issue by disabling GCs in the child process. An
alternative fix could be to increase GOMAXPROCS in the child, but maybe
letting the GC be on (which assumes it'll always be able to *eventually*
suspend a G) is just asking for trouble.

Fixes #49388.

Change-Id: I405c9dad50e24e1e68f2c52a646538da15797fbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/361897
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/crash_unix_test.go