You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Go] Data race of calling GetToTimeFunc of fixed timestamp data type #38795
Describe the bug, including details regarding any error messages, version, and platform.
Hello,
I found a data race in databricks-sql-go. A root cause of data race is timestamp fields of arrow.FixedWidthTypes and the function GetToTimeFunc() of arrow.TimestampType.
A test to reproduce a data race:
import (
"sync"
"testing"
"github.com/apache/arrow/go/v15/arrow"
)
func TestArrowDataRace(t *testing.T) {
var (
wg sync.WaitGroup
w = make(chan bool)
routineNum = 10
)
wg.Add(routineNum)
for i := 0; i < routineNum; i++ {
go func() {
defer wg.Done()
<-w
_, _ = arrow.FixedWidthTypes.Timestamp_s.(*arrow.TimestampType).GetToTimeFunc()
}()
}
close(w)
wg.Wait()
}
A command to run this test with data race detector:
go test -race -run TestArrowDataRace .
A go version is 1.21.
The same issue is in Apache Arrow Go v12.
A root cause of data race is not initialised field loc of arrow.TimestampType. It initialised in the first call of function arrow.TimestampType :: GetZone().
changed the title [-]Data race of calling `GetToTimeFunc` of fixed timestamp data type[/-][+][Go] Data race of calling `GetToTimeFunc` of fixed timestamp data type[/+]on Nov 20, 2023
Activity
[-]Data race of calling `GetToTimeFunc` of fixed timestamp data type[/-][+][Go] Data race of calling `GetToTimeFunc` of fixed timestamp data type[/+]apacheGH-38795: [Go] Fix race GetToTimeFunc for Timestamp
GH-38795: [Go] Fix race GetToTimeFunc for Timestamp (#38797)
apacheGH-38795: [Go] Fix race GetToTimeFunc for Timestamp (apache#38797)
fix: data race on Arrow v12 shared timestamp types (prewarm GetToTime…