Autodelete queue not deleted when client crashes?

3,435 views
Skip to first unread message

Marek T

unread,
Mar 13, 2015, 12:34:02 PM3/13/15
to rabbitm...@googlegroups.com
My client created 10000 autodelete queues over a single connection. Then it crashed. 

Now I am stuck with 10000 queues. There are no channels open. I would expect these queues to be automatically cleaned up by server when a channel/connection is closed.

Is there some cleanup mechanism which would get rid of the queues?

Queued messages (chart: last minute) (?)

17:30:50
17:31:00
17:31:10
17:31:20
17:31:30
17:31:40
0.0
1.0
Ready
0
Unacked
0
Total
0

Message rates (chart: last minute) (?)

Currently idle

Details

Features
auto-delete:true
PolicyHA all
Nodermqb
Slavesrabbit-debian 
State
idle
Consumers0
Consumer utilisation (?)N/A

Alvaro Videla

unread,
Mar 13, 2015, 12:36:29 PM3/13/15
to Marek T, rabbitm...@googlegroups.com
Were there consumers in the queue?

"If set, the queue is deleted when all consumers have finished using it. The last consumer can be cancelled either explicitly or because its channel is closed. If there was no consumer ever on the queue, it won't be deleted."

https://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare.auto-delete

You can still delete queues manually

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Klishin

unread,
Mar 13, 2015, 12:37:48 PM3/13/15
to rabbitm...@googlegroups.com, Marek T
 On 13 March 2015 at 17:34:04, Marek T (marek...@gmail.com) wrote:
> My client created 10000 autodelete queues over a single connection.
> Then it crashed.
>
> Now I am stuck with 10000 queues. There are no channels open. I
> would expect these queues to be automatically cleaned up by server
> when a channel/connection is closed.

Exclusive queues are deleted when client disconnects. Auto-deleted queues are removed
when last consumer is cancelled (or its channel is closed/connection is lost) *if there ever was one*.

> Is there some cleanup mechanism which would get rid of the queues?

You can delete queues using RabbitMQ clients or HTTP API. To list queues, see rabbitmqctl list_queues
or HTTP API.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Marek Tomša

unread,
Mar 13, 2015, 12:39:36 PM3/13/15
to rabbitm...@googlegroups.com
Thank you so much for the quick reply Alvaro and Michael.

This was counterintuitive for me, but now it is clear.

Jacques Bergmans

unread,
Nov 18, 2015, 7:30:24 AM11/18/15
to rabbitmq-users
Have a similar problem after updating to RabbitMQ 3.5.5, Erlang 17.5.  An auto delete queue is not deleted.

The queue is created from a Csharp application and after closing the apllication the queue remains.
Opening the queue on the RabbitMQ management website shows "no consumers".
Strange thing is that Delete button does not work: queue remains, but number of messages set to 0.
What does work is to first press the Purge button and then the Delete button, then the queue is gone.

I also have auto delete queues from python clients on the same AMQP server and there the auto delete works just fine.

Jacques Bergmans

unread,
Nov 24, 2015, 5:20:04 AM11/24/15
to rabbitmq-users
Setting the exclusive flag to true solved the problem. Now the auto delete queue is indeed removed when the number of consumers goes from 1 to 0.

Setting this exclusive flag to true was not needed with the older version of rabbitmq.

For temporary queues I can set both flags to true. This leaves the problem of how to handle non-exclusive auto-delete queues, but I don't have those queue types.

Michael Klishin

unread,
Nov 24, 2015, 7:13:07 AM11/24/15
to rabbitm...@googlegroups.com
Auto-deleted queues are deleted when last consumer
is cancelled or its channel is closed, or connection is closed,
if there ever was a consumer registered with
the basic.consume method. Consuming with
basic.get does not count as having a consumer.

Exclusive queues are deleted when their declaring
connection is closed.

Nothing has changed in this area for years.
--
Reply all
Reply to author
Forward
0 new messages