diff options
author | Paul E. Murphy <murp@ibm.com> | 2021-11-19 16:33:42 -0600 |
---|---|---|
committer | Paul Murphy <murp@ibm.com> | 2021-11-30 15:28:46 +0000 |
commit | 682435dd9991040073ae12021fac164b41376502 (patch) | |
tree | f0a1a9d71871ac1d910d49bcfc0eee0b5ede9063 /misc | |
parent | 18934e11ba6ef2b2f21f091ddf4ab6814dcf1959 (diff) | |
download | go-682435dd9991040073ae12021fac164b41376502.tar.gz go-682435dd9991040073ae12021fac164b41376502.zip |
misc/cgo/test: reduce likeliness of hang in Test9400
If a GC triggers while spinning in RewindAndSetgid, it may result in
this test hanging. Avoid it by disabling the collector before entering
the uninterruptable ASM conditional wait.
Fixes #49695
Change-Id: Ie0a03653481fb746f862469361b7840f4bfa8b67
Reviewed-on: https://go-review.googlesource.com/c/go/+/365836
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cgo/test/testdata/issue9400_linux.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/misc/cgo/test/testdata/issue9400_linux.go b/misc/cgo/test/testdata/issue9400_linux.go index e94a9bb45f5..f521b1f49a5 100644 --- a/misc/cgo/test/testdata/issue9400_linux.go +++ b/misc/cgo/test/testdata/issue9400_linux.go @@ -15,6 +15,7 @@ import "C" import ( "runtime" + "runtime/debug" "sync/atomic" "testing" @@ -46,6 +47,10 @@ func test9400(t *testing.T) { big[i] = pattern } + // Disable GC for the duration of the test. + // This avoids a potential GC deadlock when spinning in uninterruptable ASM below #49695. + defer debug.SetGCPercent(debug.SetGCPercent(-1)) + // Temporarily rewind the stack and trigger SIGSETXID issue9400.RewindAndSetgid() |