[rabbitmq-discuss] Exchange disappear

Marek Majkowski majek04 at gmail.com
Thu Nov 24 12:23:48 GMT 2011


On Thu, Nov 24, 2011 at 11:50, Rosa, Andrea <andrea.rosa at hp.com> wrote:
> Hi Marek
>
> Thanks for your help
>
>> -----Original Message-----
>> From: Marek Majkowski [mailto:majek04 at gmail.com]
>> Sent: 24 November 2011 10:23
>> To: Rosa, Andrea
>> Cc: rabbitmq-discuss at lists.rabbitmq.com
>> Subject: Re: [rabbitmq-discuss] Exchange disappear
>>
>> Hi,
>>
>> On Wed, Nov 23, 2011 at 18:02, Rosa, Andrea <andrea.rosa at hp.com> wrote:
>> > I have got a problem using the py-amqplib as client (version 0.6.1),
>> It’s
>> > more likely that my problem is in the client library but just to be
>> 100%
>> > sure I will ask to you to confirm my idea and maybe you could also
>> give me
>> > some aextra information to fix it.
>> >
>> > I have got this exception in my client log file :
>> >
>> > AMQPChannelException: (404, u"NOT_FOUND - no exchange
>> > 'a61f445d611d4f40a972d1f0c5449c77' in vhost '/'", (60, 40),
>> > 'Channel.basic_publish')
>>
>> `basic_publish` must be run against an existing exchange. If the
>> exchange
>> is not available - RabbitMQ will complain and abruptly close an amqp
>> channel.
>>
>> Make sure the exchange exists at that point - maybe put
>> `exchange_declare`
>> before the `publish` ?
>>
>
> I am sure that the publish command is called after the exchange_declare, because I can see the process work correctly for the 95% of my messages, but sometimes I have got this error.
> Maybe some race condition?

Quite possible - but rather on the client side. Just a quick question:
you're not using `no_wait`, right?

>> > And after that this error
>> >
>> > AMQPConnectionException: (503, u"COMMAND_INVALID - second
>> 'channel.open'
>> > seen", (20, 10), 'Channel.open')
>>
>> This looks like a client library issue. Not many AMQP client libraries
>> know
>> how to behave after an error ocurred.
>>
>
>> > The strange thing is that I can see the exchange in rabbitmq server.
>>
>> This is quite unlikely. Maybe you checked at different point in time?
>> Maybe the exchange was `auto_delete=True` ?
>>
>> You can verify that using `rabbitmqctl list_exchanges`, or even better,
>> using rabbitmq management plugin.
>
> Yes, I agree with you maybe I check at different point of time.
> The exchange has auto_delete=true, so maybe a possible scenario could be:
> 1 try to publish a message
> 2 the exchange is not yet created

That is going to crash the AMQP channel, you can't publish to non-existing
exchange.

> 3 second attempt to publish a message which generates the second exception (503)
> 4 the message is not published and the exchange is created.
> I verified also that that exchange has not a binding.

Publishing to existing exchange will always succeed, bindings doesn't make
a difference.

`auto-delete` exchange is deleted when last queue unbinds, is that
what you're doing?

Cheers,
   Marek


More information about the rabbitmq-discuss mailing list