Ankit Patel
WritingPapersLabsAboutContact
Paper Reviews··Updated 2026-04·2 min read·110 views

The Test Kept Fixing the Bug

Simulation Testing · Zhou et al. (SIGMOD 2021) & TigerBeetle VOPR (2023)

The same seed replays the same failure every time, so a bug that used to be unrepeatable can be handed to someone else

A fault-injection test can miss a liveness bug by being too helpful and repairing the exact failure that stalled the cluster.

That detail jumped out at me in TigerBeetle's write-up on liveness testing. Their network simulator routinely injected asymmetric partitions and later healed them, inadvertently rescuing consensus bugs that a real cluster was supposed to survive without external repair.

Distributed systems carry two distinct obligations. Safety guarantees the system never commits a corrupt or conflicting state. Liveness guarantees the system eventually makes forward progress whenever a healthy quorum can communicate. A cluster that halts forever on the first weird packet satisfies safety 100% of the time while taking production down.

Leave the broken part broken

TigerBeetle walks through a three-replica cluster: A, B, and C. Replica A suffers a one-way network fault where it can transmit packets outward while dropping every inbound reply. Isolated from heartbeats, A repeatedly starts leader-election view changes. Healthy replicas B and C dutifully step down on every higher view number, starving client commits even though B and C have a clean link between them.

Continuous random fault chaos created that exact asymmetric partition, then healed A's inbound link a few ticks later so commits resumed before any test assertion fired. Code review caught the livelock after the simulator had stepped right past it.

Fixing the test meant changing the fault schedule rather than cranking up iteration counts. After an initial chaos phase, the simulator picks a valid healthy quorum, heals links strictly inside that quorum, and freezes outside faults permanently in place. Now B and C must commit transactions while broken replica A keeps shouting indefinitely.

Reproducible seeds and fault boundaries

Deterministic simulation gives systems engineers repeatability over interleavings that kernel threads and physical NICs scatter across months. In FoundationDB's SIGMOD 2021 paper, Section 4, Zhou and colleagues run entire multi-node database clusters inside a single-threaded deterministic process driving simulated network jitter, disk latencies, and clock jumps from one pseudorandom seed. When an invariant breaks after ten million simulated steps, handing a teammate that integer seed replays the exact instruction sequence on their laptop, which is also how FoundationDB keeps its single recovery path exercised continuously before code reaches production.

Deterministic replay and assertion design still solve different halves of verification. Replaying a seed bit-for-bit cannot catch a stall if the harness silently heals the fault before checking progress.

The same trap shows up outside storage engines. Take a background job runner that retries a wedged task until an integration test fixture recycles the worker container, allowing the assertion at the bottom of the test to pass. If production promises recovery without external container restarts, the test harness just implemented part of the production recovery path on the sly.

Whenever a team says "we run chaos tests," ask what the harness heals automatically before checking invariants: network partitions, wedged workers, or full disks. Sometimes external repair matches your operational runbook. Other times, the test is quietly fixing the bug.

Continue in Paper Reviews