aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2025-08-26 13:26:57 -0700
committerMichael Knyszek <mknyszek@google.com>2025-09-09 14:46:30 -0700
commit5dcedd65504cc9cadc9a5ea8bc3af51a26eec704 (patch)
tree125db295480b4fa8173f307b2008739998b84259 /src/internal
parentd3be949ada01d7827f8edc87665fef5268634cb3 (diff)
downloadgo-5dcedd65504cc9cadc9a5ea8bc3af51a26eec704.tar.xz
runtime: lock mheap_.speciallock when allocating synctest specials
Avoid racing use of mheap_.specialBubbleAlloc. Fixes #75134 Change-Id: I0c9140c18d2bca1e1c3387cd81230f0e8c9ac23e Reviewed-on: https://go-review.googlesource.com/c/go/+/699255 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/synctest/synctest_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/internal/synctest/synctest_test.go b/src/internal/synctest/synctest_test.go
index 307eee62e2..73a0a1c453 100644
--- a/src/internal/synctest/synctest_test.go
+++ b/src/internal/synctest/synctest_test.go
@@ -779,6 +779,28 @@ func TestWaitGroupHeapAllocated(t *testing.T) {
})
}
+// Issue #75134: Many racing bubble associations.
+func TestWaitGroupManyBubbles(t *testing.T) {
+ var wg sync.WaitGroup
+ for range 100 {
+ wg.Go(func() {
+ synctest.Run(func() {
+ cancelc := make(chan struct{})
+ var wg2 sync.WaitGroup
+ for range 100 {
+ wg2.Go(func() {
+ <-cancelc
+ })
+ }
+ synctest.Wait()
+ close(cancelc)
+ wg2.Wait()
+ })
+ })
+ }
+ wg.Wait()
+}
+
func TestHappensBefore(t *testing.T) {
// Use two parallel goroutines accessing different vars to ensure that
// we correctly account for multiple goroutines in the bubble.