Commit-Cycle Failure Scenarios, Traced

Linked from Commit-Cycle Failure Scenarios

The Case Worth Studying: Changelog Written, Offset Commit Fails

offset committed at 500
process 501–520 → cache evicts → changelog + RocksDB now reflect 520
consumer.commitSync() FAILS   (coordinator unavailable, or a rebalance
                               fenced this consumer mid-cycle)

Streams surfaces this as CommitFailedException → TaskMigratedException: the task is closed and reassigned. Its new owner rebuilds state from the changelog — which already includes 501–520 — and resumes reading input from 500. Those twenty events are processed twice.

The Full Set

FailureWhat survivesDamage
Crash mid-interval, no commit attemptedWhatever the cache already evicted is in the changelog; the rest is goneReprocessing of the evicted portion only. If nothing was evicted, recovery is clean.
Offset commit fails after changelog ackedChangelog and output through 520; offset at 500Over-counting + duplicate output for 501–520. Silent.
Changelog write fails (producer error at step 2)Only records acked before the errorproducer.flush() throws, offsets never commit, the StreamThread dies per uncaught.exception.handler (REPLACE_THREAD by default). Same reprocessing window for what was acked.
Crash during restore.checkpoint was never updatedNone. Replay restarts from the last checkpointed changelog offset, and replay is idempotent.
Hard kill between the RocksDB write and the changelog sendRocksDB holds orphan writes; changelog does notCollapses into ordinary reprocessing — the offset is back at the same commit point. See Why There Is No Transaction Here.
Zombie writer — see belowBoth the zombie and the new owner are writingState corruption. The worst case, and undetectable.

The Zombie Writer

An instance stalls on a long GC pause, misses its heartbeats, and gets fenced by a rebalance. A new instance takes over the task. Then the old one wakes up — and under at-least-once its producer was never fenced, only its consumer:

Three lanes over time. The old owner stalls in a long GC pause, misses its heartbeats and is fenced by a rebalance; only its consumer is fenced, its producer is not. The new owner takes over the task and writes user_1 → 162 to the changelog. The zombie then wakes up, finishes its cycle, and writes user_1 → 150. Last write wins: the changelog now genuinely says 150, the state is wrong, nothing detects it, and every later restore reproduces the wrong value.
A fenced consumer does not fence its producer — the zombie’s write lands last Unlike every other failure in the table, this one is not bounded by a commit interval: the changelog itself now holds the wrong value, so restoring from it reproduces the corruption.

Nothing detects this. It is not bounded by a commit interval, and the corrupted value survives every subsequent restore, because the changelog now genuinely says 150. This is the strongest argument for exactly-once — stronger than duplicate counts.

↑ Back to Commit-Cycle Failure Scenarios