[rabbitmq-discuss] RabbitMQ throw 541 internal error when unbind an non-existed binding?

Junius Wang wangjunbo924 at gmail.com
Mon Feb 17 06:46:43 GMT 2014


Hi all,

                Our team installed RabbitMQ 3.0.4 and I'm trying to upgrade
it to latest 3.2.3.   However we encounter an unexpected change from
RabbitMQ.  In 3.0.4, 404 error thrown when unbind an non-existed binding but
if try to unbind an non-existed binding from in RabbitMQ 3.2.3, it throws
541 error.   Is this change expected or an issue?   

In our applications, we may unbind a binding multiple times. The first
attempt succeeds and we expect the following attempts throw 404. We catch
the 404 exception and do something later.  It works well in 3.0.4 but
unlucky in 3.2.3.  If it's an issue of 3.2.3 I will wait for an newer
version. If not ,we will have to change our code or just use 3.0.4.

 

                What's more interesting is that only when the exchange type
is "topic".  When the type is "fanout" or "direct", the expected 404 thrown.
I wrote some python test codes today to verify it:

 

#!/usr/bin/env python

import pika

 

connection =
pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))

channel = connection.channel()

 

exchange_name = 'py_test_exchange'

queue_name = 'py_test_queue'

routing_key = 'black'

exchange_type='topic'

 

channel.exchange_declare(exchange=exchange_name,type=exchange_type)

channel.queue_declare(queue=queue_name)

channel.queue_bind(exchange=exchange_name,queue=queue_name,routing_key=routi
ng_key)

 

channel.queue_unbind(exchange=exchange_name,queue=queue_name,routing_key=rou
ting_key)

channel.queue_unbind(exchange=exchange_name,queue=queue_name,routing_key=rou
ting_key)

 

channel.queue_delete(queue=queue_name)

channel.exchange_delete(exchange=exchange_name)

 

And when I run this code, it says "pika.exceptions.ChannelClosed: (541,
'INTERNAL_ERROR')".  And from the RabbitMQ logs(it says 'badmatch' probably
because the binding doesn't exist): 


=ERROR REPORT==== 17-Feb-2014::14:37:54 ===

AMQP connection <0.12741.0> (running), channel 1 - error:

{{error,

     {{badmatch,{error,[{root,none}],["black"]}},

      [{rabbit_exchange_type_topic,follow_down_get_path,2,

           [{file,"src/rabbit_exchange_type_topic.erl"},{line,139}]},

       {rabbit_exchange_type_topic,'-remove_bindings/3-lc$^1/1-1-',1,

           [{file,"src/rabbit_exchange_type_topic.erl"},{line,81}]},

       {rabbit_exchange_type_topic,remove_bindings,3,

           [{file,"src/rabbit_exchange_type_topic.erl"},{line,79}]},

       {rabbit_binding,x_callback,4,

           [{file,"src/rabbit_binding.erl"},{line,542}]},

       {rabbit_binding,'-process_deletions/1-fun-0-',2,

           [{file,"src/rabbit_binding.erl"},{line,524}]},

       {dict,map_bucket,2,[{file,"dict.erl"},{line,460}]},

       {dict,map_bkt_list,2,[{file,"dict.erl"},{line,456}]},

       {dict,map_bkt_list,2,[{file,"dict.erl"},{line,456}]}]}},

[{rabbit_misc,execute_mnesia_transaction,1,

      [{file,"src/rabbit_misc.erl"},{line,509}]},

  {rabbit_misc,execute_mnesia_tx_with_tail,1,

      [{file,"src/rabbit_misc.erl"},{line,531}]},

  {rabbit_channel,binding_action,9,

      [{file,"src/rabbit_channel.erl"},{line,1279}]},

 
{rabbit_channel,handle_cast,2,[{file,"src/rabbit_channel.erl"},{line,274}]},

  {gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,934}]},

  {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}

Any comment will be appreciated. 

 

Thanks

Junbo Wang

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140217/010c4ce1/attachment.html>


More information about the rabbitmq-discuss mailing list