SimpleAmqpClient icon indicating copy to clipboard operation
SimpleAmqpClient copied to clipboard

Client Hangs if the RabbitMQ Broker Service is not running

Open jinzishuai opened this issue 8 years ago • 5 comments

Hi there,

I am using the SimpleAmqpClient-2.4 working against rabbitmq-server-3.2.4-1 coming with Ubuntu-14.04. I found out that if the rabbitmq-server service is not running (ie, service rabbitmq-server stop), my client would hang forever instead of returning an error.

I tried a similar test using the go client (https://github.com/streadway/amqp) and it failed properly.

Is that a bug of the SimpleAmqpClient library?

Thanks, Shi

jinzishuai avatar May 13 '16 16:05 jinzishuai

I realized in the rabbitmq-c library, there are two functions

  • amqp_socket_open()
  • amqp_socket_open_noblock()

and it seems that the SimpleAmqpClient is only using the first one,thus no timeout.

My questions are

  1. Is this why our code is blocking?
  2. Can we offer a choice to specify timeout in the future?

Thank you, Shi

jinzishuai avatar May 13 '16 20:05 jinzishuai

What version of rabbitmq-c are you using?

alanxz avatar May 16 '16 04:05 alanxz

We are using the rabbitmq-c version 0.7.1.

jinzishuai avatar May 17 '16 00:05 jinzishuai

There was a bug in v0.7.1 that causes hangs like that, could you try running it with v0.8.0 and see if the issue is still there?

alanxz avatar May 17 '16 00:05 alanxz

OK. I will give that a try. Thank you for the help.

jinzishuai avatar May 17 '16 00:05 jinzishuai