Repository navigation
test(cluster): add a docker chaos harness for multi-node edge cases - #4474
Closed
almostintuitive wants to merge 2 commits into
Closed
almostintuitive wants to merge 2 commits into
almostintuitive wants to merge 2 commits into
Conversation
Several cluster bugs only show up with real processes crashing, restarting from disk or losing the network under produce load: a replica stuck behind its group after rolling crash-restarts (apache#4438), sends thrashing once partition primaries diverge (apache#4436), and acknowledged data lost on crash-restart with apache#4433 applied. Reproducing them meant hand-built scripts each time. scripts/cluster-chaos runs a 3-node cluster from a published apache/iggy image in Docker, injects one named fault scenario while producing, heals every node and reads the whole topic back. The checker (core/tools, bin cluster-chaos-checker) is built on the in-repo SDK, so it speaks the same protocol as a server from the same commit. It fails a scenario on lost acknowledged events, offset gaps, per-key reordering, keys split across partitions, unknown events, an unreadable listed tail, reads that never settle, producers giving up, or fatal node errors. Duplicates, empty polls over data and per-node GetTopic stats that disagree with the read are reported, not failed. A kind backend runs the same scenarios on the Helm chart's cluster mode. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the PR. It is labeled Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
This was referenced Oct 9, 2026
…che#4476 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4474 +/- ##
============================================
+ Coverage 87.54% 88.47% +0.92%
+ Complexity 1608 1607 -1
============================================
Files 1300 1302 +2
Lines 241253 252088 +10835
Branches 201557 212384 +10827
============================================
+ Hits 211207 223037 +11830
+ Misses 25014 23684 -1330
- Partials 5032 5367 +335
🚀 New features to boost your workflow:
|
Contributor
|
overall i like what was done here but i think we cannot use docker. i will rewrite this to incorporate all you did into our chaos-monkey test. |
Contributor
|
Hi @almostintuitive I will close down this PR as #4557 reproduces it using our internal chaos monkey testing suite. I added you as Co-author of the new PR. |
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.
Which issue does this PR address?
Relates to #4438
Relates to #4436
Also reproduces the data loss reported in this #4433 comment. The failing tests for #4438 and #4436 are in #4439 and #4437.
Rationale
#4438, #4436 and the #4433 regression only showed up with real server processes crashing, restarting from disk or losing the network while producers write, and checking afterwards that every acknowledged message can be read back. Each one was found with a throwaway script. This puts that tooling in the repository, so a maintainer can rerun a failure case on one machine with one command, and check a fix against it.
What changed?
scripts/cluster-chaosstarts a 3-node cluster in Docker from a publishedapache/iggyimage (defaultedge). Each node has a fixed IP and its data in a named volume, sokillthenstartis a real crash and a recovery from disk.run-scenario.sh <scenario>creates a topic, produces while it injects the faults of that scenario, heals every node, reads the whole topic back and writes a verdict and a result JSON. Nothing builds the server.The checker is a new binary in
core/tools(cluster-chaos-checker, next todata-seeder-tool) on the in-repo SDK, so it speaks the same protocol as a server built from the same commit.producelogs every event before its first send and again once a send carrying it is acknowledged, and retries a failed send with the same events.verifyreads every partition from offset 0 in rounds, because right after a recovery an empty poll or the end thatGetTopiclists does not prove the end of the log. A scenario fails on acknowledged events lost, offset gaps, per-key reordering, a key in two partitions, events nobody sent, a listed tail that no read returns, reads that never settle, producers giving up, or a panic or fatal shard error in a node log. Upstream has no server-side deduplication, so duplicates from retries are reported, not failed. Also reported but not failed: polls that came back empty at an offset that held data, andGetTopicas each node answers it next to what was read.baseline,controlcontrolresends 20% of events and must see every copy)crash-restartrolling-restart,isolate,pause,kill-stormcascading-crashreplicatedloss belowfull-outage,full-outage-replicatedreplicatedloss is by designrolling-crashpersisted, one kill every 80 s, 40 s downsplit-primariescrash-restart, then a clean produce phase with a p99 limitk8s/kind-cluster.shimplements the same backend commands on a local kind cluster, with one release ofhelm/charts/iggyper node in cluster mode (the chart'sexamples/cluster-3-node.yaml). A kill there iskubectl delete pod --forcewith the Deployment scaled to zero. The README covers every scenario, the expected and the buggy outcome, and how to read the results.Local Execution
apache/iggy:edge(revision2c1f70b53, two commits behind this branch's base, neither touching the server, SDK or protocol), with the checker built from this branch. Nodes at 1 CPU and 2 GiB, 2000 msg/s from 6 producers on 6 partitions for 120 s unless noted:baseline,control(30,517 resent events, 30,517 duplicates seen),crash-restart,rolling-restart,isolate,pause,kill-storm,full-outage(persisted),cascading-crash(persisted),split-primaries, androlling-crashat reduced load (5000 msg/s, kills 40 s apart, 20 s down; 866,300 events, 56needs state transferlog lines, no loss).full-outage-replicated: passes as designed, with 38,980 of 239,480 acknowledged events lost (replicatedhas no stable-storage barrier).cascading-crashwithDURABILITY=replicatedfails: 66,120 of 143,520 acknowledged events lost, and a restarted replica stopped withThe replica is divergent and was fencedand stayed down. An earlier run lost 51,860 of 196,460 the same way. I read this as the samereplicatedtrade-off, since two of three nodes crashed within the flush window, but the remaining two nodes then refused sends to some partitions until the producers gave up after 180 s. I can open an issue for that if it is not expected.split-primariespassed: in Docker at this load every partition group followed each kill to the same new primary, so the primaries never split. test(sdk): fail when sends to split partition primaries move the session #4437 is the deterministic reproduction of Rust SDK: sends to a multi-partition topic bounce between nodes once partition primaries diverge (multi-second stalls) #4436.rolling-crashat the full 30k msg/s (about 11 million events per run), andcrash-restartagainst a fix(partitions): don't commit a stale prepare after adopting a newer view #4433 build (that needs a server build). The numbers in the README for those come from Partition replica stuck after rolling crash-restarts: state transfer never completes while it keeps serving its stale prefix #4438 and the fix(partitions): don't commit a stale prepare after adopting a newer view #4433 comment.helm templatefor all three releases (withexamples/cluster-3-node.yaml) andkubeconform -strictagainst Kubernetes 1.35 (12 resources valid), plusshellcheck.cargo fmtandcargo clippy -p tools --all-targets --all-features -- -D warningsclean.docker build -f scripts/cluster-chaos/Dockerfile .built the image; the final image was built with the samecargo build --release --locked -p tools --bin cluster-chaos-checkerin a container capped at 2 CPUs.pre-commit run --files <changed>): markdownlint, shellcheck, license headers, version consistency, trailing whitespace and newline, binary artifacts, typos, skills and taplo passed. cargo fmt and clippy ran separately as above.cargo sortwas not installed, so I checked thecore/tools/Cargo.tomlorder by hand.AI Usage
controlmust see every resent copy; thereplicatedoutage scenarios lost acknowledged events and were reported). Before opening, I ran a review in the spirit ofteam-review-slimwith two reviewers (checker correctness and data-loss logic; shell, kind and docs) and fixed what applied: failed polls no longer count as a quiet read round, a non-advancing poll cannot loop forever, the partition check also covers duplicate copies, the content check compares every field, logs of an earlier run are never overwritten, fault steps no longer abort a run and node logs are saved before teardown, the kind script is executable and maps memory units, andsplit-primariesfails when its measure phase did not run. Not taken: checking each acknowledged event at its acknowledged offset, and reading every replica separately.🤖 Generated with Claude Code