The symptom and its neighbours#
The checkout service logs publish timeouts to RabbitMQ, or its publish calls simply never return. The broker is reachable, consumers on other services are still being delivered messages, and nothing in the application changed. Three causes produce something like this:
- A resource alarm. Memory use went above the high watermark, or free disk space fell below the disk free limit, on one node. RabbitMQ blocks connections that publish by suspending reads from them, and the alarm is cluster-wide: a disk alarm on one node blocks publishers on all of them. Consumers that only consume are not blocked. Memory and disk alarms · Free disk space alarms
- Flow control. A connection that publishes faster than its queues can take is throttled, blocking and unblocking several times a second. Publishing slows but does not stop, and the connection shows the state
flow. Flow control - A problem outside the broker's limits. Network loss, a client waiting forever for publisher confirms, or a node close to its file descriptor limit, which refuses new client connections instead of blocking existing ones. Memory and disk alarms · Refused or timed out?
Why they look alike#
A blocked publisher sees TCP back pressure: its writes stop being read, so publishing looks like a slow or dead network (is the latency the client's or the server's?). RabbitMQ documents that publish operations under an alarm "will eventually time out or fail outright". The client gets a notice only if it supports the connection.blocked protocol extension and the application registered a handler for it; supported clients advertise the capability by default, but many applications never log the event. Memory and disk alarms · Blocked connection notifications
Consumers can be caught too. If one connection both publishes and consumes, the alarm blocks it as a publisher, and its consumers on that connection stall with it. RabbitMQ advises separate connections for publishing and consuming for this reason.
Ask the broker#
Start with the alarms. rabbitmq-diagnostics alarms lists resource alarms in effect across the cluster. check_local_alarms is a health check for the target node only: it exits non-zero if that node has an alarm. Run the check on each node to find which one raised it. rabbitmq-diagnostics · Monitoring and health checks
rabbitmq-diagnostics -q alarms
rabbitmq-diagnostics -q check_local_alarms -n rabbit@NODE_HOST
rabbitmq-diagnostics memory_breakdown --unit megabytes -n rabbit@NODE_HOST
rabbitmq-diagnostics status -n rabbit@NODE_HOST
memory_breakdown shows what the memory is used for, and status includes the node's memory limit. The limit comes from vm_memory_high_watermark: either .relative, a fraction of detected RAM with a default of 0.6, or .absolute, which RabbitMQ recommends in containers because nodes cannot always detect the cgroup limit. The disk limit is disk_free_limit, 50 MB by default, checked against the partition that holds the node's data directory. Memory alarms · Free disk space alarms · Reasoning about memory use
Then list connections with their state. state is one of starting, tuning, opening, running, flow, blocking, blocked, closing or closed. Under an alarm, blocking means the connection has not published since and can continue; blocked means it published and is paused. The management UI shows the same states. rabbitmqctl · Memory and disk alarms
rabbitmqctl list_connections name user peer_host state channels
From a host without the CLI, the management HTTP API returns the same node facts. GET /api/nodes returns, per node, mem_used, mem_limit, mem_alarm, disk_free_limit and disk_free_alarm. It is a read; use an account with the monitoring tag rather than an administrator. Monitoring: node metrics · Management plugin
curl -s -u MONITORING_USER http://RABBIT_HOST:15672/api/nodes \
| jq '.[] | {name, mem_used, mem_limit, mem_alarm, disk_free_limit, disk_free_alarm}'
Commands such as set_vm_memory_high_watermark and set_disk_free_limit change the running node. Leave them out of the investigation; raising a limit to clear an alarm hides the reason it fired.
Read the result#
| Alarms | Publisher connections | Points to |
|---|---|---|
| Memory alarm on a node | blocked or blocking | Memory watermark reached |
| Disk alarm on a node | blocked or blocking | Free disk below the limit |
| None | flow | Flow control: queues behind publishers |
| None | running | Not the broker's limits: client, network, confirms |
For a memory alarm, the breakdown tells you where to look next: queue contents, connection buffers or something else. A memory alarm can follow a consumer problem, because messages that nobody consumes accumulate in queues. For a disk alarm, check what is filling the data partition, including messages paged out of memory.
A worked example: two hung publishers#
This example is illustrative. The fictional checkout service publishes order events to a three-node cluster, rabbit@mq-1.example.internal to mq-3. In both incidents, publish calls from checkout time out from 14:05 UTC, while the orders service keeps consuming.
In the first incident, rabbitmq-diagnostics alarms reports a disk alarm on mq-2. check_local_alarms fails on mq-2 only. Its data partition has 41 MB free against a 50 MB limit, filled by a queue whose consumer, payments, stopped at 13:20. Every checkout connection reads blocked. The fault is on mq-2, and the reason is upstream of it: a consumer that stopped draining a queue. Nodes mq-1 and mq-3 are healthy and block publishers anyway, because the alarm is cluster-wide.
In the second incident, alarms returns nothing and check_local_alarms passes on all three nodes. The checkout connections read running and the HTTP API shows memory far below the limit. The application's traces show each publish waiting for a confirm that never arrives on one channel after a client library upgrade. The broker is not blocking anything; the client is.
Limits#
Disk space is checked at least every ten seconds and more often near the limit, so a fast fill can still exhaust the disk between checks. A relative memory watermark on a node that misdetects its container's memory can fire too late, or the node can be killed by the operating system before it fires. Free disk space alarms · Memory alarms
The alarm state says why publishers are blocked now, not what filled the memory or disk. Read the consumers' queues and the consumer services for that. Other dependency failures are covered in diagnosing runtime dependency failures, and a publisher whose calls fail without a response at all may fit requests that fail with no status.
Questions#
Do RabbitMQ resource alarms block consumers?
No. Connections that only consume keep receiving deliveries. A connection that both publishes and consumes is blocked as a publisher, so its consumers can stall with it.
What does a blocked connection mean in the RabbitMQ management UI?
The connection published while a resource alarm was in effect and RabbitMQ has stopped reading from it. blocking means the connection has not published since the alarm started and will be blocked if it does.
Why are publishers blocked on every node when only one node has the alarm?
Memory and disk alarms are cluster-wide. When one node crosses its limit, all nodes block publishing connections until the alarm clears.