From: Keith Randall Date: Wed, 6 Nov 2024 21:53:02 +0000 (-0800) Subject: runtime/race: treat map concurrent access detection as a race detector hit X-Git-Tag: go1.24rc1~459 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=fc5e8f2f6ba07f999a780848aa66da7d73083c1e;p=gostls13.git runtime/race: treat map concurrent access detection as a race detector hit Sometimes the runtime realizes there is a race before the race detector does. Maybe that's a bug in the race detector? But we should probably handle it. Update #70164 (Fixes? I'm not sure.) Change-Id: Ie7e8bf2b06701368e0551b4a1aa40f6746bbddd8 Reviewed-on: https://go-review.googlesource.com/c/go/+/626036 Reviewed-by: Keith Randall Reviewed-by: Michael Pratt LUCI-TryBot-Result: Go LUCI --- diff --git a/src/runtime/race/race_test.go b/src/runtime/race/race_test.go index 4fe61683eb..cbc90ea0bb 100644 --- a/src/runtime/race/race_test.go +++ b/src/runtime/race/race_test.go @@ -107,6 +107,11 @@ func processLog(testName string, tsanLog []string) string { gotRace = true break } + if strings.Contains(s, "fatal error: concurrent map") { + // Detected by the runtime, not the race detector. + gotRace = true + break + } } failing := strings.Contains(testName, "Failing") @@ -177,8 +182,11 @@ func runTests(t *testing.T) ([]byte, error) { ) // There are races: we expect tests to fail and the exit code to be non-zero. out, _ := cmd.CombinedOutput() - if bytes.Contains(out, []byte("fatal error:")) { - // But don't expect runtime to crash. + fatals := bytes.Count(out, []byte("fatal error:")) + mapFatals := bytes.Count(out, []byte("fatal error: concurrent map")) + if fatals > mapFatals { + // But don't expect runtime to crash (other than + // in the map concurrent access detector). return out, fmt.Errorf("runtime fatal error") } return out, nil