Skip to content

Zombie channels on RabbitMQ

This article addresses how to close zombie channels on rabbitmq

The problem

I was presented with a problem that some consumers of a queue on RabbitMQ were taking a lot of time to complete causing the messages to be moved into the “Unacked” pile.

This pile of “Unacked” messages grew increasingly as the workers could not finish the task on time.

The Solution

Well first we optimized the process that the workers were doing, so that they can complete the task on time (without being killed by a timeout) and then we needed to move the messages from the “Unacked” pile. The latter was done by a colleague who kindly explained how this can be achieved.

Navigate to the RabbitMQ admin panel, then:

  1. Go to a queue that has the "zombie channels"
  2. Copy the workers port (this is just for searching purposes)
  3. Go to the connections tab and filter using the port number that you copied in step 2
  4. Access the connection
  5. On the connection detail page, scroll down and click the button that reads "close channel"

By closing the channel, the messages that were stuck on this "zombie channel" and therefore on the "Unacked" pile will be moved again to the ready pile, leaving you to process those messages again at your convenience.

This was a problem that got the team struggling for a little bit.

As always it was a good learning experience, and since this situation happened we have taken notes to revisit the logic inside the workers to make sure that we don’t hit that timeout limit again.