Skip to main content
AboutWorkExperienceLogHireResume
  1. Home
  2. /
  3. Log
  4. /
  5. A 1% crash rate dead-lettered 1,305 healthy messages

1 Nov 2026/Praxis

A 1% crash rate dead-lettered 1,305 healthy messages

Every crash costs each leased message a delivery attempt, so healthy messages batched with a crashing one reached the five-attempt limit. Leasing by evidence fixed it; the throughput it cost needed a second change.

1,305 → 0healthy messages dead-lettered under injected crashes, before and on a fresh fault seed

Written up 22 Nov 2026

Context

Praxis consumes its event stream from Pub/Sub, with an in-memory broker that follows the same rules for tests and chaos runs. The broker counts a delivery attempt for every lease that ends without an ack: a nack, an expired lease and a crashed process all count the same. After five attempts a message goes to the dead-letter queue. That policy is meant for poison, a message that fails every time and should stop blocking the stream.

Symptom

The Phase 15 chaos run (fault seed 801) failed its consumer_crash check. At a 1% crash rate the batched warehouse consumer dead-lettered 1,305 messages that had nothing wrong with them.

Root cause

When a process dies, every message it holds under lease loses an attempt, whatever caused the crash. The batched consumer leased a full batch, and after a crash the batch came back as one leased group, still containing the message that had crashed it. Each further crash cost every member another attempt, so healthy messages reached five on the strength of their neighbours. The broker cannot say which message killed a process, and the consumer made no attempt to find out.

Fix

Each consumer now limits and groups what it leases by how much evidence there is against each message:

  • ·Slow start. A new process cannot tell a first start from a restart after a crash, so it leases one message, doubles its window after each completed pull up to the batch size, and drops back to one after a crash.
  • ·Tiers within a pull. First deliveries run first, as one atomic group. First redeliveries run next, as their own group. A message delivered three or more times runs last and alone, and a pull that held one shrinks the window to one, so suspects are leased by themselves.
  • ·The broker still bounds poison. A message that kills the process every time ends up leased alone, so only its own count rises, and it is dead-lettered after five attempts as before.

The rule was chosen on development seeds only, by comparing variants:

Flow-control variants on development fault seeds (synthetic chaos world)
VariantHealthy dead lettersEvents/s
Every redelivery alone0433
Window set by crashes32, 37~1,750
Isolate at 3, keep window24, 19~980
Isolate at 3, shrink window (chosen)0930–1,040
Isolate at 4, shrink window1~1,290

“Isolate at 3” leases a message alone from its third delivery. Events/s is chaos throughput; paired counts are two seeds. Source: Praxis docs/adr/0025-crash-isolating-consumer-flow-control.md. Isolating one attempt later already lets a healthy message through.

The final rule was run once on a fresh fault seed (803): 249 isolated crashes, no healthy message dead-lettered, exactly the 12 injected poison events dead-lettered on each subscription, and final state equal to the oracle.

Trade-off

It failed the performance gate. Under the nightly chaos injection, throughput fell from 2,046 to 932 events a second against a floor of 1,218. Profiling put 66 of 145 seconds in Warehouse.insert_events: 17,118 calls, 11,263 of them single-message writes of isolated redeliveries. A one-row write cost about 3 ms almost regardless of size, and 2.2 ms of that was DuckDB’s INSERT … ON CONFLICT into the primary-key table. A plain INSERT into the same table took 0.7 ms.

So the write path changed instead of the rule. Ids already stored are found by a primary-key lookup and skipped, new rows go in with a plain INSERT, and if another writer gets there between the lookup and the insert, the key raises and the batch is re-run with the original ON CONFLICT statement. A property test pins the result to the reference loader. A one-row write fell from 3.06 to 0.81 ms, and an interleaved A/B gave a median of 1,718 events a second, against 2,059 before any of this and 980 for the unoptimised fix. A second fresh seed (804) passed all 12 resilience checks.

Status

Closed, with residual risk recorded in the ADR. Nothing bounds collateral below the broker’s five attempts, because first redeliveries still share a group, and real Pub/Sub does not preserve redelivery order the way the in-memory broker does. Chaos throughput stays about 17% below where it started. Four days later the primary key this write path relies on had to go for a different reason, covered in the entry on removing it.

Sources

  • ADR 0025 and Amendment 1, accepted 1 Nov 2026
  • Commit 5815d9f, which committed Phase 15 on 4 Nov 2026

Read the Praxis case study

OlderThe full pipeline froze the machine because two things could not spill
NewerRemoving the primary key fixed memory, then made streaming writes quadratic
HomeProjectsAboutExperienceLogHireContactResumeGitHubLinkedIn
© 2026 Bhargav Kr Nath