NOT_FOUND - no exchange 'foo_bar' in vhost '/'

8,951 views
Skip to first unread message

Marko Iskander

unread,
Dec 1, 2014, 10:40:21 AM12/1/14
to rabbitm...@googlegroups.com
I am having an issue with a Ruby consumer loosing connection to RabbitMQ after a while processing events. The only error I have coming from that consumer is:
"NOT_FOUND - no exchange 'foo_bar' in vhost '/' "

We use this exchange from multiple consumers, they all process the messages just fine after a restart but after another time period the same error is thrown and the consumer is no longer connected. I am unsure how to even start troubleshooting this issue. Other consumers with different exchanges work just fine on the same machine, no errors are reported in any of the RabbitMQ logs.

Any ideas what might be causing this issue?



Michael Klishin

unread,
Dec 1, 2014, 10:43:12 AM12/1/14
to rabbitm...@googlegroups.com, Marko Iskander
You are trying to use an exchange that does not exist. Can it be declared as auto-deleted?
Can the queues bound to it be exclusive? We cannot suggest much without seeing relevant
snippets of your code.

Note that consumers *do not* use exchanges, they use queues. Which are bound to exchanges.
So how your queues are declared and used matters quite a bit.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Marko Iskander

unread,
Dec 1, 2014, 10:47:16 AM12/1/14
to rabbitm...@googlegroups.com, markoi...@gmail.com
They are created with the auto_delete true flag, below is the implementation of how we define and bind to the exchange.


exchange = channel.topic("foo_bar", auto_delete: true)
queue = channel.queue("queue_name")
queue.bind(exchange, routing_key: "routing_key")

Can you clarify how the auto_delete will cause this issue? 

Michael Klishin

unread,
Dec 1, 2014, 10:52:37 AM12/1/14
to rabbitm...@googlegroups.com, Marko Iskander
On 1 December 2014 at 18:47:19, Marko Iskander (markoi...@gmail.com) wrote:
> They are created with the auto_delete true flag, below is the
> implementation of how we define and bind to the exchange.
>
> > exchange = channel.topic("foo_bar", auto_delete: true)
> > queue = channel.queue("queue_name")
> > queue.bind(exchange, routing_key: "routing_key")

This means your queues are non-exclusive (assuming this code uses Bunny,
which I think it does) and non-autodelete.

> Can you clarify how the auto_delete will cause this issue?

If at any point all queues are unbound from foo_bar (or deleted), then foo_bar itself
will. Are you sure you want this? Does your topology change a lot of is it nearly static?

 What's the reasoning behind making the exchange auto-delete?

Marko Iskander

unread,
Dec 1, 2014, 11:29:04 AM12/1/14
to rabbitm...@googlegroups.com, markoi...@gmail.com
Thank you, that helped pin point the actual cause. One of our consumers that we expected to be up was failing and so the queue was being deleted therefore causing the exchange to be deleted. 

We will revisit the auto_delete but short time fixing the consumer to not crash is a good start!

Thanks again for your quick responses.
Reply all
Reply to author
Forward
0 new messages