fix(prover-node): do not abort in-flight proving jobs on a clean shutdown#24562
Draft
AztecBot wants to merge 1 commit into
Draft
fix(prover-node): do not abort in-flight proving jobs on a clean shutdown#24562AztecBot wants to merge 1 commit into
AztecBot wants to merge 1 commit into
Conversation
dd12b69 to
98c348b
Compare
9f93efd to
faf519e
Compare
faf519e to
602a8ba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #24558 (base is that PR's branch,
cb/prover-broker-abort-reenqueue) — review/merge that one first.Problem
When the prover node shuts down cleanly (a deploy/restart),
ProverNode.stop()callsEpochProvingJob.stop('stopped')→interruptProcessing()→prover.cancel(). That cancel tears down the orchestrator's scheduler and, depending on config, aborts every in-flight broker job. Aborting on a clean restart is wasteful: the in-flight proofs are still valid, the agents are mid-flight, and a restarted node re-orchestrating the same epoch produces the exact same (deterministically-hashed) job ids. Cancelling them throws that work away and forces a re-prove from scratch.The orchestrator already had the right primitive —
resetSchedulerState(abortJobs), whose own docs say aborting is correct on reorg and wrong on shutdown, and the top-tree sub-orchestrator already threads anabortJobsflag — but the top-levelProvingOrchestrator.cancel()applied a single staticcancelJobsOnStopconfig to every cancellation reason, with no way to say "this one is a clean shutdown, keep the jobs".Fix
Make the cancel reason-aware, so a clean shutdown never aborts the broker jobs while reorg/timeout/failure keep the existing configured behaviour:
EpochProver.cancel(abortJobs?: boolean)— optional override; when omitted, the orchestrator's configuredcancelJobsOnStopis used (unchanged default).ProvingOrchestrator.cancel(abortJobs = this.cancelJobsOnStop)passes the flag through toresetSchedulerState, and its graceful-stop path (cancelInternal) now passesfalse, matching the top-tree sub-orchestrator which already does this.EpochProvingJob.interruptProcessing()passesfalsewhen the terminal state is'stopped'(clean shutdown), and otherwise defers to the configured behaviour.This composes with #24558: even if a stale in-flight job were somehow aborted, that PR already stops the abort from being persisted; together, a clean redeploy mid-epoch neither cancels the in-flight jobs nor poisons them, so the epoch keeps proving across the restart.
Tests
orchestrator_lifecycle.test.ts:cancel(false)leaves the in-flight jobs' abort signals untouched even whencancelJobsOnStopistrue, andcancel(true)aborts them even when it isfalse.epoch-proving-job.test.ts: a clean external stop callsprover.cancel(false); a reorg-driven stop does not forceabortJobs=false.Note: not run locally in this session — executing these suites needs a full noir/wasm bootstrap that wasn't available here — so relied on CI.
Created by claudebox · group:
slackbot