aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/rwmutex_test.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2017-10-25 18:36:12 -0400
committerAustin Clements <austin@google.com>2017-10-26 20:38:48 +0000
commitda95254d1aee5b2497b784b7bfd9d0972505a48d (patch)
treeca9dc339fac3239b58acde4d7114153703fb5f1b /src/runtime/rwmutex_test.go
parent4d8d138318123d2cb92fb2674bfb910282516550 (diff)
downloadgo-da95254d1aee5b2497b784b7bfd9d0972505a48d.tar.gz
go-da95254d1aee5b2497b784b7bfd9d0972505a48d.zip
runtime: "fix" non-preemptible loop in TestParallelRWMutexReaders
TestParallelRWMutexReaders has a non-preemptible loop in it that can deadlock if GC triggers. "Fix" it like we've fixed similar tests. Updates #10958. Change-Id: I13618f522f5ef0c864e7171ad2f655edececacd7 Reviewed-on: https://go-review.googlesource.com/73710 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/rwmutex_test.go')
-rw-r--r--src/runtime/rwmutex_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/rwmutex_test.go b/src/runtime/rwmutex_test.go
index a69eca1511..872b3b098e 100644
--- a/src/runtime/rwmutex_test.go
+++ b/src/runtime/rwmutex_test.go
@@ -12,6 +12,7 @@ package runtime_test
import (
"fmt"
. "runtime"
+ "runtime/debug"
"sync/atomic"
"testing"
)
@@ -47,6 +48,10 @@ func doTestParallelReaders(numReaders int) {
func TestParallelRWMutexReaders(t *testing.T) {
defer GOMAXPROCS(GOMAXPROCS(-1))
+ // If runtime triggers a forced GC during this test then it will deadlock,
+ // since the goroutines can't be stopped/preempted.
+ // Disable GC for this test (see issue #10958).
+ defer debug.SetGCPercent(debug.SetGCPercent(-1))
doTestParallelReaders(1)
doTestParallelReaders(3)
doTestParallelReaders(4)