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
Wait for input/output handlers to finish when closing a StreamStore
Otherwise it's possible that the scheduler will close the DTask before all
outputs have been sent, which would cause the downstream tasks to hang. This is
how it could happen:
1. A streaming task starts.
2. The output handler task calls `take!(::ProcessRingBuffer)` on an output
buffer, finds it empty, and `yield()`'s.
3. The task executes, pushes its output to the output buffers, reaches `max_evals`
and finishes.
4. The scheduler finishes the corresponding DTask.
5. The `take!(::ProcessRingBuffer)` call resumes. The buffer isn't empty anymore
but it calls `task_may_cancel(; must_force=true)` before continuing and
throws an exception since the scheduler has finished the DTask. The result is
that the last output is never sent, and the exeption is swallowed by the
output handler started by `initialize_output_stream!()`.
6. Downstream tasks don't get that last result so they never reach `max_evals`
and spin forever.
Fixed by storing the handler tasks in the `StreamStore` and closing them in
`close(::StreamStore)`.
Also increased the timeout of the 'Single task running forever' task because it
will sometimes timeout before the default 10s is up.
0 commit comments