Skip to content

testing/synctest: unexpected data race after synctest.Wait #74327

Closed as not planned
@terinjokes

Description

@terinjokes

Go version

go version go1.25rc1 linux/amd64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/terin/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/terin/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2428105469=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/terin/Development/github.com/cloudflare/certinel/go.mod'
GOMODCACHE='/home/terin/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/terin/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/terin/sdk/go1.25rc1'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/terin/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/terin/sdk/go1.25rc1/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25rc1'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

I've written a test using testing/synctest that I expected to be free of data races. https://go.dev/play/p/FKlttCmxPIz?v=gotip

What did you see happen?

WARNING: DATA RACE
Write at 0x00c000124430 by goroutine 10:
  github.com/cloudflare/certinel/ticker.TestTickerSync.func1.1()
      /home/terin/Development/github.com/cloudflare/certinel/ticker/ticker_go125_test.go:20 +0x72

Previous read at 0x00c000124430 by goroutine 9:
  github.com/cloudflare/certinel/ticker.TestTickerSync.func1()
      /home/terin/Development/github.com/cloudflare/certinel/ticker/ticker_go125_test.go:30 +0x191
  testing.tRunner()
      /home/terin/sdk/go1.25rc1/src/testing/testing.go:1931 +0x21c
  testing.testingSynctestTest.gowrap1()
      /home/terin/sdk/go1.25rc1/src/testing/testing.go:2043 +0x44

What did you expect to see?

No data race as the read of variable errWatcher happened after synctest.Wait and the goroutine that writes to it was (to my current understanding) durably blocked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions