aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2025-05-22 11:14:53 -0700
committerGopher Robot <gobot@golang.org>2025-05-29 12:49:36 -0700
commit21b7e60c6b64dd3221ab5b95d164fb42492029e8 (patch)
tree97881264d6ec2f6c7f793b69dc7d215e0517b953 /src/testing
parent555d425d177db7fa7123779d253aee42980cb8a3 (diff)
downloadgo-21b7e60c6b64dd3221ab5b95d164fb42492029e8.tar.xz
runtime, testing/synctest: breaking bubble isolation with Cond is fatal
sync.Cond.Wait is durably blocking. Waking a goroutine out of Cond.Wait from outside its bubble panics. Make this panic a fatal panic, since it leaves the notifyList in an inconsistent state. We could do some work to make this a recoverable panic, but the complexity doesn't seem worth the outcome. For #67434 Change-Id: I88874c1519c2e5c0063175297a9b120cedabcd07 Reviewed-on: https://go-review.googlesource.com/c/go/+/675617 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/synctest/synctest.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/testing/synctest/synctest.go b/src/testing/synctest/synctest.go
index 1664cb8484..a44047a971 100644
--- a/src/testing/synctest/synctest.go
+++ b/src/testing/synctest/synctest.go
@@ -92,7 +92,10 @@
//
// A [sync.WaitGroup] becomes associated with a bubble on the first
// call to Add or Go. Once a WaitGroup is associated with a bubble,
-// calling Add or Go from outside that bubble panics.
+// calling Add or Go from outside that bubble is a fatal error.
+//
+// [sync.Cond.Wait] is durably blocking. Waking a goroutine in a bubble
+// blocked on Cond.Wait from outside the bubble is a fatal error.
//
// Cleanup functions and finalizers registered with
// [runtime.AddCleanup] and [runtime.SetFinalizer]