1
0
mirror of https://github.com/golang/go synced 2024-07-08 12:18:55 +00:00

misc/cgo/test: further reduce likeliness of hang in Test9400

As suggested by #49680, a GC could be in-progress when we
disable GC. Force a GC after we pause to ensure we don't
hang in this case.

For #49695

Change-Id: I4fc4c06ef2ac174217c3dcf7d58c7669226e2d24
Reviewed-on: https://go-review.googlesource.com/c/go/+/367874
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Paul Murphy <murp@ibm.com>
This commit is contained in:
Paul E. Murphy 2021-11-19 16:33:42 -06:00 committed by Paul Murphy
parent 5f63f168da
commit 7ccbcc9056

View File

@ -50,6 +50,8 @@ func test9400(t *testing.T) {
// 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))
// And finish any pending GC after we pause, if any.
runtime.GC()
// Temporarily rewind the stack and trigger SIGSETXID
issue9400.RewindAndSetgid()