Skip to content

testing/synctest: ThreadSanitizer: CHECK failed #78156

Description

@MarcoPolo

Go version

go version go1.26.0 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/marco/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/marco/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1127945307=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/tmp/tsan-minimal-repro/go.mod'
GOMODCACHE='/home/marco/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/marco/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/marco/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.26.0'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

https://go.dev/play/p/d6EcTCqfGr-

Running the above code fails on both linux amd64 and darwin/arm64.

This issue is possibly related to #76691.

A cursory investigation makes me think it may be related to concurrent use of bubble.timers.raceCtx from multiple OS threads.

What did you see happen?

> go test -race -count=1
ThreadSanitizer: CHECK failed: tsan_rtl.cpp:346 "((exiting || thr->fast_state.epoch() == kEpochLast)) != (0)" (0x0, 0x0) (tid=1652744)
exit status 66
FAIL    tsan-minimal-repro/repro1       0.032s

What did you expect to see?

Same test without synctest:

> go test -race -count=1
PASS
ok      tsan-minimal-repro/repro1       1.087s

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions