Queue can't be deleted or purged in RabbitMQ
search cancel

Queue can't be deleted or purged in RabbitMQ

book

Article ID: 293242

calendar_today

Updated On:

Products

VMware RabbitMQ

Issue/Introduction

is article applies to all versions of RabbitMQ. 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"


Environment

Product Version: 3.7

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

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