alanxz / SimpleAmqpClient

Simple C++ Interface to rabbitmq-c
MIT License
401 stars 214 forks source link

Client Hangs if the RabbitMQ Broker Service is not running #127

Open jinzishuai opened 8 years ago

jinzishuai commented 8 years ago

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 commented 8 years ago

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

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

alanxz commented 8 years ago

What version of rabbitmq-c are you using?

jinzishuai commented 8 years ago

We are using the rabbitmq-c version 0.7.1.

alanxz commented 8 years ago

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?

jinzishuai commented 8 years ago

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