Integration / RabbitMQ Interview Questions
How do you troubleshoot unacknowledged message buildup in RabbitMQ?
A growing "unacked" count on a queue means messages have been delivered to consumers but never confirmed, which ties up memory and, at high prefetch, can eventually trigger flow control.
- Check consumer health first - is the process alive, is it stuck in a long-running operation, or did it crash without the broker noticing yet (connection still technically open)?
- Review the code path for missing acks - a common bug is acking only on the success path and forgetting to ack/nack on exceptions, so failed messages never get resolved either way.
- Check prefetch
- Use consumer_timeout (RabbitMQ 3.8+, enabled by default) which forces the channel closed if a consumer holds a message unacked for too long, automatically requeuing it instead of letting it hang forever.
- Confirm via the management UI - the per-queue and per-channel "unacked" counters make it easy to see which consumer is the source of the backlog.
The fix is almost always either a code bug around the ack/nack path, a stuck downstream dependency slowing the consumer, or a prefetch value that is too generous for the workload.
More Related questions...