Failure Scenarios
How RabbitMQ systems break in production, and how each looks
Most of these were reproduced while building this module, and are marked.
| # | Failure | Symptom | Where to look | Fix |
|---|---|---|---|---|
| 1 | Queues created with one member (reproduced) | type quorum but members [one node]; a single node loss loses them | list_queues name type members | target_cluster_size_hint, membership reconciliation, rabbitmq-queues grow |
| 2 | Node down (reproduced) | Leaders move; clients reconnect | cluster_status; dashboard | Restart; quorum queues keep working with a majority |
| 3 | Client can't fail over (reproduced) | Crash with a DNS error when a node goes away | Client logs (gaierror) | Try each node; catch network errors, not just AMQP ones |
| 4 | Resource alarm (reproduced) | Every publisher hangs; consumers fine | rabbitmq-diagnostics alarms | Drain the backlog, add consumers, add memory/disk; connection.blocked handlers |
| 5 | Silent loss: unroutable (reproduced) | Published messages never arrive | Unroutable metrics | mandatory, alternate exchanges, correct bindings |
| 6 | Silent loss: overflow without confirms (reproduced) | Queue at its limit drops new messages; publisher sees nothing | Queue length, confirm nacks | Publisher confirms; handle nacks |
| 7 | Poison message loop (reproduced) | 100% CPU consumer, constant redeliveries, queue stuck | Redelivered rate | Reject without requeue; delayed retries with an attempt count |
| 8 | Crash-looping consumer (reproduced) | Message bounces until the delivery limit | x-delivery-count, dead-letter rate | Fix the bug; inspect the dead-letter queue |
| 9 | Prefetch too high (reproduced) | Slow consumers hoard work, others idle | Unacked per consumer | Prefetch sized to processing time |
| 10 | Connection churn | Broker CPU high, connections_opened rate high | Dashboard churn panel | One long-lived connection per process |
| 11 | Long queue | Latency high, memory/disk growing, Raft log large | Ready count over time | Scale consumers on depth; length limits; streams for big backlogs |
| 12 | Consumer timeout | Long jobs killed and redelivered every 30 min | Channel closed with PRECONDITION_FAILED (delivery ack timeout) | Raise consumer_timeout for that queue, or break up the job |
| 13 | Quorum lost | Two of three nodes down: the queue stops accepting writes | quorum_status | Restore a majority; never run two-node clusters |
| 14 | Drain didn't move everything (reproduced) | Stream still led by a node in maintenance | list_queues name type leader | Verify after draining |
Reading the signals
"Publishers are hanging." Almost always a resource alarm: check
rabbitmq-diagnostics alarms first. Then flow control (connections in
state flow in the UI), then a queue at reject-publish overflow (with
confirms, the publisher sees nacks), then quorum loss.
"Messages are missing." Unroutable (check the metric and bindings)?
Overflow with drop-head, or reject-publish without confirms? Expired by
TTL (dead-letter reason expired, or just gone if there's no DLX)? Auto-ack
consumer that crashed? A non-durable queue or transient message on a classic
queue across a restart?
"Messages are processed twice." Expected under at-least-once: consumer crashed after the side effect and before the ack, or a publisher retried after a lost confirm. Make the consumer idempotent.
RabbitMQ incidents cluster around one theme: queues that grow. A slow consumer, a poison message, a downstream outage, and the backlog builds until memory or disk alarms stop the whole cluster. Alert on backlog growth early, scale consumers on queue depth, cap queues, and have a documented answer for "what do we shed when we're overloaded?"
Game day
docker compose -f compose_prod.yaml run --rm labs python quorum_failover.py # keep running
docker stop rabbit-2 # 1. node down
docker stop rabbit-3 # 2. quorum lost: what happens to publishing?
docker start rabbit-2 rabbit-3
docker exec rabbit-1 rabbitmqctl set_vm_memory_high_watermark 0.0001 # 3. memory alarm
docker exec rabbit-1 rabbitmqctl set_vm_memory_high_watermark 0.6
# 4. poison message: publish invalid JSON to a queue whose consumer nack-requeues on parse errors
# 5. unroutable: publish to orders with routing key "orderz.created.eu" in a loopFor each, note what alerted first and what a human had to do.