7phs opened a new issue, #38795:
URL: https://github.com/apache/arrow/issues/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()`.
   
   
   ### Component(s)
   
   Go


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to