fix(scheduler): fail running jobs when all executors are lost - #2212
Conversation
|
Thanks for picking this up — the diagnosis is right and the shape of the fix (bounded wait, scoped to the Disclosure: this review was produced with LLM assistance (Claude Code). Code references were checked against the tree; the Scenario G timing analysis below is derived from reading the code, not from an executed run. First: there's already a regression test for this, and it's waiting on you#2026 added an HA chaos harness whose whole purpose was to drive these fault-tolerance paths on a real multi-process cluster, and #2029 is one of the three bugs it surfaced. It ships a dedicated reproducer:
#[ignore = "reproduces #2029: killing every executor hangs the job instead of failing it"]
By my reading it should pass as-is, with no assertion changes:
Suggested follow-through:
Worth being explicit about what Scenario G does not cover, because it's blind to finding 1 below: it kills two executors and asserts only that the job terminates, so it passes even with duplicate failure events. It also never exercises the recovery path (executor returns inside the grace window), which is the actual new behaviour being introduced. Review findings1. Duplicate grace timers → N
|
|
Thanks for the contribution @akshaychitneni. Sorry for the long AI review above. I would start with enabling the existing test and see if that passes. We can address other points in follow on PRs potentially. Let me know what you think. |
|
Minor design related question: Is there a strong reason to distinguish between a cluster that has not registered its first executor and one that has lost all registered executors? From the perspective of a running job, both cases appear equivalent: there are no executors available and the job cannot make progress. Would it be cleaner to apply the same configurable grace period in both cases, rather than allowing jobs submitted before the first executor appears to wait indefinitely? This would also bound failures caused by executor startup or configuration problems. |
Sure. I will work in integrating with test harness. |
This is a good callout. From a running job's view they are equivalent. I would keep them separate for now because "lost all executors" has an ExecutorLost event to trigger on, while "no first executor yet" has no event and would need a different mechanism (like a startup timeout). This is also already mitigated on k8s by the existing /readyz probe, which keeps an executor-less scheduler out of the k8s service and not accept jobs from clients |
3fb5611 to
07512e8
Compare
@andygrove updated to work with chaos harness |
07512e8 to
036254a
Compare
milenkovicm
left a comment
There was a problem hiding this comment.
thanks @akshaychitneni one minor comment, does it make senes to provide an option to disable this behaviour ?
| default_value_t = 30, | ||
| help = "Grace period, in seconds, to wait for an executor to (re)register after the last executor is lost before failing running jobs. Prevents jobs from hanging forever when every executor dies, while still tolerating a transient total loss (e.g. a rolling restart). Set to 0 to fail as soon as the loss is observed." | ||
| )] | ||
| pub no_executors_grace_period_seconds: u64, |
There was a problem hiding this comment.
would it make sense to have option to disable this behavior? can we use 0 to disable it ?
There was a problem hiding this comment.
thanks for the review @milenkovicm. Any specific reason to allow disabling this? It would just re-introduce the bug hanging jobs on exec loss without failing
There was a problem hiding this comment.
to be honest i don't have, i just wondering, i guess if someone needs such functionality they could make waiting time quite big
…#2029) When every executor dies mid-query, the scheduler reset the affected tasks but had nothing to schedule them onto, leaving the job Running forever and hanging the client. On ExecutorLost, if no live executors remain, wait a bounded, configurable grace period (no_executors_grace_period_seconds, default 30s) for an executor to (re)register, then fail any still-running job with a clear error. The check is scoped to the ExecutorLost path, so jobs merely queued waiting for their first executor (autoscaling cold start) are unaffected. Adds unit tests for both total loss (job fails) and partial loss (job survives while an executor remains).
036254a to
be34777
Compare
Thanks for the comment, and makes total sense. The reason I'm raising this is I think it'd be great to aim for simplicity wherever possible. Having fewer knobs and a simpler state machine to reason about can be very helpful, both for admins and end users. But this higher level design can probably be revisited once all these critical issues have first been cleaned up. |
|
@andygrove @milenkovicm Could we merge this PR if you dont have any other comments |
|
Thanks @akshaychitneni and @villebro & @andygrove for review |
When every executor dies mid-query, the scheduler reset the affected tasks but had nothing to schedule them onto, leaving the job Running forever and hanging the client.
On ExecutorLost, if no live executors remain, wait a bounded, configurable grace period (no_executors_grace_period_seconds, default 30s) for an executor to (re)register, then fail any still-running job with a clear error. The check is scoped to the ExecutorLost path, so jobs merely queued waiting for their first executor (autoscaling cold start) are unaffected.
Adds unit tests for both total loss (job fails) and partial loss (job survives while an executor remains).
Which issue does this PR close?
Closes #. #2029
Rationale for this change
When all executors die mid-query, the scheduler leaves the job
Runningforever and the client hangs.What changes are included in this PR?
On
ExecutorLostwith no live executors left, wait a bounded, configurable grace period (no_executors_grace_period_seconds, default 30s) for an executor to re-register, thenfail any still-running job.
Are there any user-facing changes?
New scheduler config
no_executors_grace_period_seconds(default 30s); a total executor loss now fails jobs with a clear error instead of hanging.