[rabbitmq-discuss] pika's blocking channel exchange_declare hanging???

Ask Solem ask at rabbitmq.com
Mon Jan 14 16:56:30 GMT 2013


On Jan 11, 2013, at 2:04 AM, Dragos Manolescu <Dragos.Manolescu at servicenow.com> wrote:

> Hi --
> 
> I am experiencing a behavior I didn't expect--and don't understand :( In the following simplified code:
> 
>         try:
>             self.out_channel.exchange_declare\
>                 ( exchange=exchange
>                 , type="topic"
>                 , passive=False
>                 , durable=True
>                 , auto_delete=False
>                 , nowait=True
>             )
>             msg_props = pika.BasicProperties(content_type="application/json", delivery_mode=2)
>             self.out_channel.basic_publish\
>                 ( body=message
>                 , exchange=exchange
>                 , properties=msg_props
>                 , routing_key=routing_key
>                 )
>         except pika.exceptions.AMQPError:
>             self.logger.exception("Message not sent")
> 
> The exchange_declare above seems to block indefinitely; out-channel is a channel obtained from a blocking connection.

Do you have a traceback from the blocking (usually you can get one from hitting Ctrl+C).
Does the rabbitmq logs say anything during this period?

> 
> Here's the context: node N1 (which contains the above code) uses pika.BlockingConnection to communicate with the broker, which is connected to two other nodes N2 and N3. Upon receiving  a message from N2 via a fanout exchange, N1 acknowledges it and then sends N2 a message over a different, topic exchange. The interaction between N1 and N3 follows an identical pattern.
> 
> I noticed that when both N2 and N3 send messages to N1, the above code works as I thought it would only for one of them (say N2), while the exchange_declare hangs for the other (N3). The code works fine if I comment out the exchange_declare call. N1 uses 2 channels, one for incoming messages (fanout exchange) and one for outgoing messages (topic exchange).
> 
> I am using RabbitMQ 3.0.0 and pika 0.9.8.
> 
> Many (but not) all samples invoke exchange_declare as I did above (as it is idempotent) so I assume that I'm missing something rather than making a call I should not make. FWIW the exchange_declare for N1's other, fanout exchange never hangs.
> 
> Thanks,
> 
> -dm
> 
> 
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss



More information about the rabbitmq-discuss mailing list