gmr/pamqp

unmarshal heartbeat issue

Closed this issue · 1 comments

I have noticed that the unmarshal method is executed successfully on a Heartbeat frame even when the buffer does not yet have the FRAME_END.
This violates the specifications of the amqp 0.9.1 protocol. At the moment, I have solved it in this way:

count, channel, frame = unmarshal(buf)
if frame.name == Heartbeat.name and buf[-1] != FRAME_END:
    raise UnmarshalingException()

In my situation, I developed an AMQP sidecar designed to emulate a RabbitMQ broker for communication with Solace PubSub+. Prior to applying the fix, I experienced several timeout errors related to heartbeat management, particularly with Node.js clients using amqplib.

I've seen that the problem only occurs with buffers that are too small. By increasing the size of the read buffer, the fix is not necessary.