diff --git a/src/executor.cc b/src/executor.cc index 6b8b0a247..506e19d4c 100644 --- a/src/executor.cc +++ b/src/executor.cc @@ -159,7 +159,14 @@ namespace detail { bool executor::handle_command(const command_pkg& pkg, const std::vector& dependencies) { switch(pkg.cmd) { - case command_type::HORIZON: create_job(pkg, dependencies, task_mngr); break; + case command_type::HORIZON: { + // Similar to task commands, a worker might receive the horizon command before creating the corresponding horizon task + const auto horizon_tid = std::get(pkg.data).horizon_tid; + if(!task_mngr.has_task(horizon_tid)) return false; + + create_job(pkg, dependencies, task_mngr); + break; + } case command_type::PUSH: create_job(pkg, dependencies, *btm, buffer_mngr); break; case command_type::AWAIT_PUSH: create_job(pkg, dependencies, *btm); break; case command_type::REDUCTION: create_job(pkg, dependencies, reduction_mngr); break;