Skip to content

Sch: Propagate a failure to dependents before deleting the failed task - #763

Merged
jpsamaroo merged 1 commit into
JuliaParallel:masterfrom
aalquwayfili:sch-failed-dependents
Oct 7, 2026
Merged

jpsamaroo merged 1 commit into
JuliaParallel:masterfrom
aalquwayfili:sch-failed-dependents

Conversation

@aalquwayfili

Copy link
Copy Markdown
Contributor

Fixes #762.

finish_task! and set_failed! called delete_unused_task! and then schedule_dependents!. Each dependent builds its DTaskFailedException from the upstream error with load_result(state, origin). When nothing else referenced the upstream task, the delete had already cleared its result, load_result asserted, and the eager scheduler exited.

This swaps the two calls in both places, so the result is deleted after the dependents have read it. The comment on task_delete! described the old order, so I shortened it. Failure paths still do not recycle the thunk.

The new test in test/thunk.jl builds a chain where only the last task is referenced. On master it fails with SchedulingException (Scheduler exited).

thunk and scheduler pass on Julia 1.10, 1.11 and 1.12. datadeps, task-queues, allocations and mutation pass on 1.12. The broken tests in thunk (1) and scheduler (5) are the same ones as on master.

The change only moves a call, so it adds no work and no allocation.

Both failure paths (`finish_task!` and `set_failed!`) called
`delete_unused_task!` and only then `schedule_dependents!`. Each
dependent builds its own `DTaskFailedException` from the upstream error
with `load_result(state, origin)`. If nothing else referenced the
upstream task, the delete had just cleared its result, so `load_result`
hit

    AssertionError: Thunk[1] is not yet finished

on the scheduler task, and the eager scheduler exited. Every task then in
flight failed with `SchedulingException (Scheduler exited)`.

This needs a failed task whose `DTask` is no longer referenced and that
still has dependents, which is what the intermediate tasks of a chain or
of a tree reduction are. Propagate first, then delete.
@jpsamaroo
jpsamaroo merged commit 1160f1e into JuliaParallel:master Oct 7, 2026
41 of 57 checks passed
@jpsamaroo

Copy link
Copy Markdown
Member

Great catch, thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A failed task with dependents can take down the eager scheduler

2 participants