[rabbitmq-discuss] Is heartbeat option working in C-client?

Dawn L dawn_l2012 at yahoo.com
Sun Dec 2 15:49:10 GMT 2012


Matthias,
    Thanks for your quick response. My client has sent messages to the server right after the connection is opened, as well as when heartbeat is received... I'm pretty sure that the server has received the message since my client has got a response from it. Everything looks to be right and according the requirement, that's why I suspect that the heartbeat machanism might not be fully working on the server side, since even though it receives data from the client it still tears down the connection. I wonder if you or anybody have been using heartbeat in C-client and has it ever worked?
 
   The program I'm writing has been working for a few months and I'm trying to add heartbeat handling to deal with the unreliable network.  
 
Best regards.
Dawn


________________________________
From: Matthias Radestock <matthias at rabbitmq.com>
To: Dawn L <dawn_l2012 at yahoo.com>; Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com> 
Sent: Sunday, December 2, 2012 4:39 AM
Subject: Re: [rabbitmq-discuss] Is heartbeat option working in C-client?

Dawn,

On 02/12/12 08:44, Dawn L wrote:
> My C-client can start to receive heartbeat message (the message has
> frame_type "AMQP_FRAME_HEARTBEAT"). However, after getting the
> heartbeat messages for two times, the connection and channels opened
> by my client have been abruptly closed by the server.

Looks like the server did not receive any frame for too long. Check the
server logs to confirm thwat.

> From what I read in the past articals, if the client sends any kind
> of message to server before the timeout, the connection shouldn't be
> closed. However, this is not the case for me - I've tried to respond
> with either normal messages (via normal channel), or frames with
> frame type AMQP_FRAME_HEARTBEAT (via channel 0) right after the
> client received the heartbead message, but the connection is still
> closed by the server regardless. Is it because the heartbeat
> functionality has not been fully implemented yet? Or is there any
> special kind of message that should be send as response message to
> the heartbeat message?

Heartbeats in the sending and receiving direction are completely independent. When a heartbeat interval has been agreed then each peer is supposed to send *some* data to the other at least every heartbeat_interval. The heartbeat frames are there to fill in the time slots when no other data is being sent.

So you certainly shouldn't be *waiting* to receive a heartbeat before sending something since that would establish an artificial interlocking of the sending and receiving direction.

For more details see section 4.2.7 of the AMQP 0-9-1 spec.

If you think you are doing everything right and the connection is still being torn down then look at a protocol trace with wireshark. That should hopefully identify the problem.

Regards,

Matthias.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20121202/aa14db4f/attachment.htm>


More information about the rabbitmq-discuss mailing list