how to update race detector to latest tsan?

120 views
Skip to first unread message

Jason E. Aten

unread,
Jul 7, 2025, 9:22:43 AMJul 7
to golang-nuts
I'm trying to characterize the race-detector/tsan corruption
on the latest pre-release of go1.25 (at b062eb46e8e76ad39029d0c1b13e4eb81c692c20
which is tagged as "release-branch.go1.25").

I tried to follow the Go src/runtime/race/README instructions
to update the race detector to the latest in the llvm repo, since it
is 20 months old, and maybe there have been fixes applied( probably
wishful thinking, but worth a quick try...), but I'm not having any luck with "racebuild":

jaten@rog /usr/local/dev-go/go/src/runtime/race (go1.25-goj) $ racebuild -goroot /usr/local/dev-go/go -platforms darwin/amd64v1  -rev 46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d

2025/07/07 08:12:24 using Go revision: b062eb46e8e76ad39029d0c1b13e4eb81c692c20

2025/07/07 08:12:24 darwin/amd64v1: gomote [create -status=false gotip-darwin-amd64_14]

Please visit https://www.google.com/device in your browser and enter verification code:

XXX-XXX-XXXX

# Error running create: failed to create buildlet (1): rpc error: code = PermissionDenied desc = unexpected HTTP status code received from server: 403 (Forbidden); transport: received unexpected content-type "text/html; charset=UTF-8"

2025/07/07 08:13:34 darwin/amd64v1: gomote [create -status=false gotip-darwin-amd64_14] failed:

Please visit https://www.google.com/device in your browser and enter verification code:

XXX-XXX-XXXX

# Error running create: failed to create buildlet (1): rpc error: code = PermissionDenied desc = unexpected HTTP status code received from server: 403 (Forbidden); transport: received unexpected content-type "text/html; charset=UTF-8"

2025/07/07 08:13:34 darwin/amd64v1: instance creation failed, retrying

2025/07/07 08:13:34 darwin/amd64v1: gomote [create -status=false gotip-darwin-amd64_14]

# Error running create: failed to create buildlet (1): rpc error: code = Permission\

Denied desc = unexpected HTTP status code received from server: 403 (Forbidden); tr\

ansport: received unexpected content-type "text/html; charset=UTF-8"

2025/07/07 08:13:35 darwin/amd64v1: gomote [create -status=false gotip-darwin-amd64_14] failed:

# Error running create: failed to create buildlet (1): rpc error: code = Permission\

Denied desc = unexpected HTTP status code received from server: 403 (Forbidden); tr\

ansport: received unexpected content-type "text/html; charset=UTF-8"

2025/07/07 08:13:35 darwin/amd64v1: instance creation failed, retrying

2025/07/07 08:13:35 darwin/amd64v1: gomote [create -status=false gotip-darwin-amd64_14]

... lots more of the same, after signing into my gmail...

Is it possible to do this locally and not with the Go distributed build system?

Thanks!

Jason

Jason E. Aten

unread,
Jul 7, 2025, 10:09:45 AMJul 7
to golang-nuts
Ah. I see that racebuild is just a thin wrapper around a shell script. Ok. So I tried to
execute that shell script manually. I find a race in that build of the race detector... full irony!

jaten@rog /usr $ cd local/dev-go/go/ jaten@rog /usr/local/dev-go/go (go1.25-goj) $ ls api CONTRIBUTING.md lib PATENTS SECURITY.md VERSION bin doc LICENSE pkg src VERSION~ codereview.cfg go.env misc README.md test jaten@rog /usr/local/dev-go/go (go1.25-goj) $ cd .. jaten@rog /usr/local/dev-go $ mkdir tmp jaten@rog /usr/local/dev-go $ cd tmp jaten@rog /usr/local/dev-go/tmp $ curl -L -o llvm.zip https://github.com/llvm/llvm-project/archive/46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 318M 0 318M 0 0 6697k 0 --:--:-- 0:00:48 --:--:-- 6865k jaten@rog /usr/local/dev-go/tmp $ unzip -q llvm.zip llvm-project-46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d/compiler-rt/* jaten@rog /usr/local/dev-go/tmp $ ls llvm-project-46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d llvm.zip jaten@rog /usr/local/dev-go/tmp $ cd llvm-project-46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d/ jaten@rog /usr/local/dev-go/tmp/llvm-project-46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d $ cd compiler-rt/lib/tsan/go jaten@rog /usr/local/dev-go/tmp/llvm-project-46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d/compiler-rt/lib/tsan/go $ ls build.bat buildgo.sh test.c tsan_go.cpp jaten@rog /usr/local/dev-go/tmp/llvm-project-46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d/compiler-rt/lib/tsan/go $ ./buildgo.sh In file included from ../rtl/tsan_sync.h:19, from ../rtl/tsan_rtl.h:47, from tsan_go.cpp:13: ../rtl/tsan_dense_alloc.h: In instantiation of ‘void __tsan::DenseSlabAlloc< <template-parameter-1-1>, <anonymous>, <anonymous>, <anonymous> >::Drain(Cache*) [with T = __tsan::MBlock; long unsigned int kL1Size = 262144; long unsigned int kL2Size = 4096; long long unsigned int kReserved = 3221225472; Cache = __tsan::DenseSlabAllocCache]’: ../rtl/tsan_dense_alloc.h:77:7: required from ‘void __tsan::DenseSlabAlloc< <template-parameter-1-1>, <anonymous>, <anonymous>, <anonymous> >::Free(Cache*, IndexT) [with T = __tsan::MBlock; long unsigned int kL1Size = 262144; long unsigned int kL2Size = 4096; long long unsigned int kReserved = 3221225472; Cache = __tsan::DenseSlabAllocCache; IndexT = unsigned int]’ ../rtl/tsan_sync.cpp:84:26: required from here ../rtl/tsan_dense_alloc.h:165:46: warning: suggest parentheses around arithmetic in operand of ‘|’ [ ]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wparentheses -Wparentheses ]8;; ] 165 | xchg = head_idx | (cmp & kCounterMask) + kCounterInc; | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ ../rtl/tsan_dense_alloc.h: In instantiation of ‘void __tsan::DenseSlabAlloc< <template-parameter-1-1>, <anonymous>, <anonymous>, <anonymous> >::Drain(Cache*) [with T = __tsan::SyncVar; long unsigned int kL1Size = 1048576; long unsigned int kL2Size = 1024; long long unsigned int kReserved = 3221225472; Cache = __tsan::DenseSlabAllocCache]’: ../rtl/tsan_dense_alloc.h:77:7: required from ‘void __tsan::DenseSlabAlloc< <template-parameter-1-1>, <anonymous>, <anonymous>, <anonymous> >::Free(Cache*, IndexT) [with T = __tsan::SyncVar; long unsigned int kL1Size = 1048576; long unsigned int kL2Size = 1024; long long unsigned int kReserved = 3221225472; Cache = __tsan::DenseSlabAllocCache; IndexT = unsigned int]’ ../rtl/tsan_sync.cpp:92:25: required from here ../rtl/tsan_dense_alloc.h:165:46: warning: suggest parentheses around arithmetic in operand of ‘|’ [ ]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wparentheses -Wparentheses ]8;; ] cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics gcc gotsan.cpp -c -o ./race_linux_amd64.syso -I../rtl -I../.. -I../../sanitizer_common -I../../../include -std=c++17 -Wall -fno-exceptions -fno-rtti -DSANITIZER_GO=1 -DSANITIZER_DEADLOCK_DETECTOR_VERSION=2 -fPIC -Wno-maybe-uninitialized -ffreestanding -Wno-unused-const-variable -Wno-unknown-warning-option -m64 -msse3 -DSANITIZER_DEBUG=0 -O3 -fomit-frame-pointer In file included from ../rtl/tsan_sync.h:19, from ../rtl/tsan_rtl.h:47, from tsan_go.cpp:13: ../rtl/tsan_dense_alloc.h: In instantiation of ‘void __tsan::DenseSlabAlloc< <template-parameter-1-1>, <anonymous>, <anonymous>, <anonymous> >::Drain(Cache*) [with T = __tsan::MBlock; long unsigned int kL1Size = 262144; long unsigned int kL2Size = 4096; long long unsigned int kReserved = 3221225472; Cache = __tsan::DenseSlabAllocCache]’: ../rtl/tsan_dense_alloc.h:77:7: required from ‘void __tsan::DenseSlabAlloc< <template-parameter-1-1>, <anonymous>, <anonymous>, <anonymous> >::Free(Cache*, IndexT) [with T = __tsan::MBlock; long unsigned int kL1Size = 262144; long unsigned int kL2Size = 4096; long long unsigned int kReserved = 3221225472; Cache = __tsan::DenseSlabAllocCache; IndexT = unsigned int]’ ../rtl/tsan_sync.cpp:84:26: required from here ../rtl/tsan_dense_alloc.h:165:46: warning: suggest parentheses around arithmetic in operand of ‘|’ [ ]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wparentheses -Wparentheses ]8;; ] 165 | xchg = head_idx | (cmp & kCounterMask) + kCounterInc; | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ ../rtl/tsan_dense_alloc.h: In instantiation of ‘void __tsan::DenseSlabAlloc< <template-parameter-1-1>, <anonymous>, <anonymous>, <anonymous> >::Drain(Cache*) [with T = __tsan::SyncVar; long unsigned int kL1Size = 1048576; long unsigned int kL2Size = 1024; long long unsigned int kReserved = 3221225472; Cache = __tsan::DenseSlabAllocCache]’: ../rtl/tsan_dense_alloc.h:77:7: required from ‘void __tsan::DenseSlabAlloc< <template-parameter-1-1>, <anonymous>, <anonymous>, <anonymous> >::Free(Cache*, IndexT) [with T = __tsan::SyncVar; long unsigned int kL1Size = 1048576; long unsigned int kL2Size = 1024; long long unsigned int kReserved = 3221225472; Cache = __tsan::DenseSlabAllocCache; IndexT = unsigned int]’ ../rtl/tsan_sync.cpp:92:25: required from here ../rtl/tsan_dense_alloc.h:165:46: warning: suggest parentheses around arithmetic in operand of ‘|’ [ ]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wparentheses -Wparentheses ]8;; ] cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics ================== WARNING: DATA RACE Read at 0x00c011110000 by goroutine 2: <null>() <null>:0 +0x0 Previous write at 0x00c011110000 by main goroutine: <null>() <null>:0 +0x0 <null>() <null>:0 +0x0 Goroutine 2 (running) created at: <null>() <null>:0 +0x0 ================== Found 1 data race(s) jaten@rog /usr/local/dev-go/tmp/llvm-project-46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d/compiler-rt/lib/tsan/go $

Jason E. Aten

unread,
Jul 7, 2025, 10:14:07 AMJul 7
to golang-nuts
Ugh. I don't know why groups removed all the newlines in that paste. Here it is again with manually inserted newlines:

Jason E. Aten

unread,
Jul 7, 2025, 10:48:46 AMJul 7
to golang-nuts
Reply all
Reply to author
Forward
0 new messages