Pivotal Knowledge Base

Follow

Queue can't be deleted or purged in RabbitMQ

Environment

Product Version
RabbitMQ 3.6.2 in cluster mode
RabbitMQ for Pivotal Cloud Foundry® (PCF) 1.6.0 to 1.6.3

Symptom

The queue and the status of the queue can be seen but when trying to get a message from the web interface, a "404 Not found" message is shown.

Logs show the following message:

/var/vcap/sys/log/rabbitmq-server/rabbit@030527a1f34b7790bc39389580262edf.log:operation queue.purge caused a channel exception not_found: "failed to perform operation on queue 'QUEUE' in vhost 'VHOST' due to timeout"

Resolution

There are two possible workarounds when this issue is found:

1. Restart the node that handles the queue.

2. Execute the following command for each queue to delete them: 

rabbitmqctl eval '{ok, Q} = rabbit_amqqueue:lookup(rabbit_misc:r(<<"VHOST">>, queue, <<"QUEUE">>)), rabbit_amqqueue:delete_crashed(Q).'

VHOST needs to be replaced with the vhost hosting the queue; and QUEUE_NAME with the name of the queue you want to delete.

If using RabbitMQ for PCF, you may need to bring RabbitMQ and Erlang into your environment as follows and from there you can use rabbitmqctl:

bash-4.1# export PATH=$PATH:/var/vcap/packages/rabbitmq-server/bin
bash-4.1# export PATH=$PATH:/var/vcap/packages/erlang/bin 

There is a difference between these two methods. Restarting will preserve messages that are already on the disk while deleting will not.

Impact/Risks

As stated in the previous section, using the command to delete the queues will delete messages stored in the queue.

Additional Information

RabbitMQ 3.6.3 solves this issue, so upgrading to this version will eradicate this problem. If using RabbitMQ in PCF, use the 1.6.4 version as it contains Rabbit 3.6.3 that has a fix for this issue.

Comments

Powered by Zendesk