Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNHANDLED TASK ERROR: ArgumentError: destination has fewer elements than required #449

Closed
StevenWhitaker opened this issue Nov 1, 2023 · 1 comment · Fixed by #452
Closed

Comments

@StevenWhitaker
Copy link

I looked more into an error I reported previously in #437 (repeated below):

      From worker 3:    UNHANDLED TASK ERROR: ArgumentError: destination has fewer elements than required
      From worker 3:    Stacktrace:
      From worker 3:     [1] copyto!(dest::Vector{Dagger.Sch.ProcessorState}, src::Base.ValueIterator{Dict{Dagger.Processor, Dagger.Sch.ProcessorState}})
      From worker 3:       @ Base ./abstractarray.jl:949
      From worker 3:     [2] _collect
      From worker 3:       @ ./array.jl:713 [inlined]
      From worker 3:     [3] collect
      From worker 3:       @ ./array.jl:707 [inlined]
      From worker 3:     [4] macro expansion
      From worker 3:       @ ~/.julia/packages/Dagger/M13n0/src/sch/Sch.jl:1189 [inlined]
      From worker 3:     [5] (::Dagger.Sch.var"#128#135"{Dagger.Sch.ProcessorInternalState, UInt64, RemoteChannel{Channel{Any}}, Dagger.ThreadProc})()
      From worker 3:       @ Dagger.Sch ./task.jl:134

The offending line (line 1189 in the stacktrace):

states = collect(proc_states(values, uid))

proc_states(values, uid) returns a ValueIterator of all_states (which comes from PROCESSOR_TASK_STATE). Unfortunately, as I understand it, the lock is released before the call to collect, meaning all_states can change before collect finishes (i.e., after allocating memory, but before actually iterating through the values).

@jpsamaroo
Copy link
Member

Good find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants