Repository navigation
ci(docker): cluster failover test on the candidate image (#290) - #322
Merged
Merged
Conversation
Three instances on SeaweedFS. The first is killed with SIGKILL ten seconds before a scheduled release is due: the other two must serve the site and Studio again within 60 s with the published content intact, and the release must run exactly once, not early, and be live everywhere. The killed instance rejoins on its volume; then b and c stop gracefully in turn while the others take a steady load, with not one failed request and an exit within the grace period. No instance may log a migration error. Every docker command and request is bounded, the step has timeout-minutes, and a failure prints each instance's state, release, runs, scheduler status and log. The script refuses to run outside GitHub Actions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Madraka <8898640+Madraka@users.noreply.github.com>
…#290) The failover test's first run found it: while c, the database's owner, stopped gracefully, a's site Worker got "D1_ERROR: Network connection lost" on its state read and answered RFC-0043's unavailable page (503) once. A request on its way to a Durable Object that moves is lost; the next one reaches the new owner, and Cloudflare's guidance is to retry such errors when the statement is idempotent. D1Driver now retries get and all of a read-only statement (SELECT, or WITH without a write, never RETURNING) on a lost connection or an object reset, about 2 s in all; overload, other errors, writes and batches fail as before. The failover test now records a failed answer's status, retry-after and x-cloudhal-* headers and the start of its body, and prints 300 log lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Madraka <8898640+Madraka@users.noreply.github.com>
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.
The cluster failover test the owner asked for on 2026-11-23 (RFC-0047 §7, §12). 0.11.0 shipped without one.
What it does
scripts/failover-smoke.tsis a new step, Cluster failover test, indocker.yml's build job. It runs after the Helm smoke oncloudhal:ci, the single-platform local copy (#312), so it gatestaglike the other smokes.docker kill --signal KILL10 s before the release is due. Within 60 s, b and c must both serve:/api/admin/sites, which reads D1.published. It must have exactly onesucceededrun, which did not start before its time, and the new title must be live on b and c. Then a starts again on its volume, rejoins and serves the change.docker stop --timeout 15while the other two take a steady load (site, post and D1 read, every 100 ms, from 3 s before the stop to 25 s after). Not one request may fail. Each instance must exit by itself, without exit code 137, in under 15 s. One of b or c owns the database after step 3, so one of these stops is a real handoff.migration "(Self-host cluster: instances starting together race on migrations ("duplicate column name", uncaught) #309), and the release still has exactly one run.What the first run found, and the fix
Run 46234540828 passed every step up to the second graceful stop. While c, which owned D1 after a's SIGKILL, stopped gracefully, one request to a got a 503 (
site /at 191.3 s).a's log at that moment:
That 503 is RFC-0043's
unavailablepage.status-entry.tsanswers it whenever the state read throws. The cause is a request that was on its way to the D1 object as the object moved to its new owner. This is a product bug, not a probe bug: the probe targets only a and b, which kept running, and every other request in those 28 s succeeded.The fix, in
@cloudhal/storage(patch changeset):D1Driverretriesgetandallof a read-only statement (SELECT, orWITHwithout a write, neverRETURNING), about 2 s in all.test/d1-retry.test.tscovers it.test/d1.test.ts(the Miniflare D1 conformance suite) still passes.Probe changes:
retry-after, thex-cloudhal-*headers and the start of its body.Docs: the guide's "Stopping" bullet now says reads are retried on the new owner, and that a write caught in the move fails once.
Bounds and diagnostics
dockercall has atimeout, and every request has a 10 sAbortSignal.timeout. Each wait has its own deadline, and the step hastimeout-minutes: 20.docker ps, each instance's health, site status, release, runs and/api/admin/schedules/status, and the last 150 log lines of every container.GITHUB_ACTIONS=true), so it never runs on a developer machine.Docs
The self-host guide's "Several instances" section links the test and says what it checks.
deploy/docker/README.mdnames it. The Limits section is unchanged, because none of its items is about failover.@cloudhal/storagegets a patch changeset for the D1 read retry.Checked locally
actionlint,pnpm lint,biome check --diagnostic-level=error,pnpm size:checktscon the scriptThere were no Docker runs locally: the PR's own docker.yml run is the test.
Closes #290
🤖 Generated with Claude Code