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

Matthias Radestock matthias at rabbitmq.com
Sun Dec 2 10:39:10 GMT 2012


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.



More information about the rabbitmq-discuss mailing list