Nested task error on Julia-1.12-rc1

Any idea what is going on here? Enable multithreading · ufechner7/FLORIDyn.jl@f2175f3 · GitHub

      Testing Running tests...
runFLORIDyn - online: Error During Test at /home/runner/work/FLORIDyn.jl/FLORIDyn.jl/test/test_floridyn_cl.jl:153
  Got exception outside of a @test
  TaskFailedException
  
      nested task error: BoundsError: attempt to access 1-element Vector{WindFarm} at index [2]
      Stacktrace:
       [1] throw_boundserror(A::Vector{WindFarm}, I::Tuple{Int64})
         @ Base ./essentials.jl:15
       [2] getindex
         @ ./essentials.jl:919 [inlined]
       [3] macro expansion
         @ ~/work/FLORIDyn.jl/FLORIDyn.jl/src/visualisation/calc_flowfield.jl:99 [inlined]
       [4] (::FLORIDyn.var"#getMeasurements##2#getMeasurements##3"{FLORIDyn.var"#getMeasurements##4#getMeasurements##5"{Matrix{Float64}, Matrix{Float64}, Float64, Settings, Floris, Wind, Vector{WindFarm}, Array{Float64, 3}, Tuple{Int64, Int64}, UnitRange{Int64}}})(tid::Int64; onethread::Bool)
         @ FLORIDyn ./threadingconstructs.jl:276
       [5] #getMeasurements##2
         @ ./threadingconstructs.jl:243 [inlined]
       [6] 

Have there been changes with respect to threading in Julia 1.12?

My tests pass on Julia 1.10 and 1.11.

That’s your problem. PSA: Thread-local state is no longer recommended; Common misconceptions about threadid() and nthreads()

1 Like

What is the suggested work-around?

There are multiple suggested in the linked blog post:

1 Like

Ive been meaning to update that blog post. I’d say my new main recommendation would be to switch to OhMyThreads.jl.

We have some pretty detailed docs on specifically this problem here: Thread-Safe Storage · OhMyThreads.jl

10 Likes