GeneTinderholm commented on issue #279:
URL: https://github.com/apache/arrow-go/issues/279#issuecomment-2664057386

   Update: Go 1.24 does not seem to have removed the issue. It took a while to 
get a deployment going on a non-production machine that had avx2 instructions. 
I seem to have narrowed it down to something to do with tracing. The following 
program exits almost immediately:
   
   ```go
   package main
   
   import (
        "fmt"
        "github.com/apache/arrow-go/v18/internal/utils"
        "golang.org/x/exp/rand"
        "golang.org/x/sys/cpu"
        "log"
        "math"
        "os"
        "reflect"
        "runtime"
        "runtime/trace"
        "sync"
   )
   
   func main() {
        prettyPrintCPU()
        if f, err := os.Create("trace.out"); err != nil {
                log.Fatal("could not open trace file")
        } else {
                defer f.Close()
                trace.Start(f)
                defer trace.Stop()
        }
   
        runtime.GOMAXPROCS(runtime.GOMAXPROCS(-1) * 2) // this was put in to 
have more goroutine swapping, not sure if it's actually required
        wg := sync.WaitGroup{}
   
        wg.Add(1)
        var arr []int32
        for range 1_000_000 {
                arr = append(arr, int32(rand.Int()%math.MaxInt32))
        }
        for range 10_000 {
                go func() {
                        for {
                                minVal, maxVal := utils.GetMinMaxInt32(arr)
                                if rand.Int()%1_000_000 == 0 {
                                        fmt.Println(minVal, maxVal)
                                }
                        }
                }()
        }
        wg.Wait()
   }
   
   func prettyPrintCPU() {
        cpuInfo := cpu.X86
        val := reflect.ValueOf(cpuInfo)
        fmt.Println("CPU INFO:")
        for i := range val.NumField() {
                field := val.Type().Field(i)
                fieldVal := val.Field(i)
                fmt.Println(field.Name, fieldVal)
        }
   }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to