Repository navigation
3.x.x: settle the SIGTERM drain's block before the next fault, so a settlement-lock hold cannot start ahead of the landing's revision bump (#686) - #691
Conversation
…ettlement-lock hold cannot start ahead of the landing's revision bump (#686) The drain leaves its found block for the relaunched frontend to land. The landing confirms the block and bumps the payout revision, and until work at the new revision is published every share on the old work is refused stale-job. The harness started the next fault once the frontend answered /healthz, whatever state the block was in. When the bump landed just before faults-pr-smoke's settlement-lock took SETTLEMENT_LOCK, the holder also blocked the republication, so every share in the first half of the hold was refused (#686: 3 CI failures). SigtermDrain now has a settle step, like the SIGKILL's landing wait and #640's gate. Once the frontend serves again, it polls the block's row until it is submitted, then reads qbit_prism_cluster.payout_revision and every frontend's /healthz until each is ok, publishes payout_state_generation equal to that revision, and has delivered that work to every authorized session. The recovery window, and so the next fault, waits for it, bounded at 60 s. A new sigterm-drain check fails the drain when the settle did not finish, because without it a block that never landed would pass and the next fault would measure the missing bump. The evidence reports the landing and settle times and the last reading. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5edc441190
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- The faults phase's bound adds DRAIN_SETTLE_WAIT for a drain, as it adds the lease wait for a SIGKILL, so a slow settle reads as a settle failure rather than a truncated phase. - A candidate that goes terminal without landing (abandoned, orphaned), or whose row is gone, ends the settle at once instead of polling for 60 s. - A block the shutdown itself landed counts as landed before the exit, and the check now says "the block landed" rather than crediting the relaunch. - A settle read whose task was lost is replaced (Spawned::lost) instead of holding the wait to its bound. The last read's error is cleared by a later good read, so a passing settle carries no stale error. - The detail prints its timings as sentences, not Option debug output. - One reqwest client for the settle, and every frontend's /healthz read at once with a 2 s limit, after the revision. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Ran a high-effort code review on 5edc441. It made eight findings: seven are fixed in 7994150, and one is a follow-up. Fixed:
Follow-up:
|
A work read that started just before DRAIN_SETTLE_WAIT ran out and finished after it could record success, reporting a settle past the bound as within it. It now counts only while the bound holds; otherwise the settle reports that it did not settle in time. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a quiet cluster, whichever fault landed a block before it (#692) (#699) #691 made the SIGTERM drain wait until its block had landed and every frontend served work at the payout revision the landing committed. Other faults land a block too, frontend-sigkill, block-failover and candidate-backlog, and none waits for the republication. A settlement-lock straight after one took SETTLEMENT_LOCK while the landing's work was unpublished, blocked that publication too, and every retained-work share in the first half of its hold was refused stale-job, the same failure as #686. The settlement-lock fault now waits, from the start of its injection, until every frontend is ready, publishes payout_state_generation equal to the cluster's payout_revision and has delivered that work to every authorized session, with no backend holding or waiting for SETTLEMENT_LOCK, so the holder is not queued behind a settlement still under way. The wait is bounded at 60 s, included in the phase's time bound; a cluster that never goes quiet gets the lock at the bound. A found block still to land does not hold the wait: every bump of the payout revision takes SETTLEMENT_LOCK, so none can happen under the lock. The holder reads the payout revision in its own transaction once it has the lock, and the fault reads every frontend's /healthz once more before the hold starts. A new check passes only if, under the lock, every frontend was ready and publishing work at that revision, so a tip that reached the frontends after the last reading fails the hold instead of passing it. The evidence records when the cluster was quiet, the last reading before the lock, the revision under the lock and the reading under it; the hold's ACK summary is now taken from the lock's acquisition. The wait is the drain's work half, moved into a WorkCurrentWait both faults use, with unit tests for its states. Locally, pinned to two CPUs, a preset copy running frontend-sigkill,settlement-lock with baseline=0 failed the settlement-lock fault in 8 of 8 runs before, each with "0 of 60 accepted (stale-job 60)". With the quiet wait it passed in all 36 runs, 10 of 10 at the final head, where the lock queued at most 0.02 s behind a quiet reading and the hold's ACK p99 was 9-19 ms. On the real node, with two frontends and 500 sessions, pool-exhaustion then settlement-lock passed with the cluster quiet at once and every frontend serving the locked revision. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fixes the flake in #686. Follow-up: #692. Test-only: the harness changes and the server doesn't.
Why
faults_under_load_drain_an_offer_in_flight_and_outlast_a_settlement_lock_holderfailed three times: twice on PRs, once on a 3.x.x push. Each time:sigterm-drainleaves its found block for the relaunched frontend to land.stale-job. That window is normally 1–2 s./healthz, whatever state the block was in.settlement-locktookSETTLEMENT_LOCK, the holder also blocked the republication. So every share in the first half of the hold was refused.#686 has the full analysis.
What
SigtermDrain::poll_settle. Modelled on the SIGKILL fault's landing wait and 3.x.x: pause the session load's shares around scenario 2's own blocks, and start each replayed transcript after earlier blocks land (#631, #632) #640's gate. Once the frontend serves again, it:submitted;qbit_prism_cluster.payout_revisionand every frontend's/healthzuntil each one isok, publishespayout_state_generationequal to that revision, and reportsauthorized_missing_current_work == 0.The fault's recovery window, and so the next fault's gap, waits for it. The wait is bounded by
DRAIN_SETTLE_WAIT(60 s).A new
sigterm-draincheck: "the relaunch landed the block and every frontend served work at its revision". It fails the drain if the settle didn't finish. Without it, a block that never landed would pass, and the next fault would measure the missing bump.Evidence: the landing time, the settle time, the last candidate row and the last reading.
Docs: the README's fault table, the scenario criteria in
test/e2e-scenarios.toml, and the test's module doc.Unit test: the
current()predicate.Evidence
Loops of 20 runs each on the build host. Every run was pinned with
tasksetto 2 CPUs, like the CI runner, and used a managed PostgreSQL 16 cluster.186903df)e41c7a80)cargo test -p qbit-prism-load --test faults, the per-PR testbaseline=0), run through the harness binaryBefore, forced:
After, forced:
Why the forced loop is the comparison: on the stock schedule the race is rare. It hit 3 of the roughly 50 CI runs sampled in #686, and none of 27 local runs. The intermediate head
5edc4411also passed 20 of 20 on both loops.Not changed
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.