diff --git a/src/sch/Sch.jl b/src/sch/Sch.jl index 61ef9804d..41d160413 100644 --- a/src/sch/Sch.jl +++ b/src/sch/Sch.jl @@ -905,7 +905,9 @@ function (ets::FireTaskSpec)() bt = catch_backtrace() # FIXME: Catch the correct task ID thunk_id = first_task.thunk_id - put!(chan, TaskResult(pid, proc, thunk_id, CapturedException(err, bt), nothing)) + if isopen(chan) + put!(chan, TaskResult(pid, proc, thunk_id, CapturedException(err, bt), nothing)) + end finally @maybelog ctx timespan_finish(ctx, :fire, (;uid, worker=pid), nothing) end diff --git a/src/utils/reuse.jl b/src/utils/reuse.jl index 9515e8e1b..c4d3783b9 100644 --- a/src/utils/reuse.jl +++ b/src/utils/reuse.jl @@ -587,8 +587,8 @@ function reusable_task_loop(chan::Channel{Any}, ready::Threads.Atomic{Bool}) while true f = try take!(chan) - catch - if !isopen(chan) + catch err + if !isopen(chan) || err isa InterruptException # scheduler exiting return else rethrow()