Skip to content

NoAck Consumers get socket closed by rabbitmq due to lack of heartbeat #98

@tom-railpod

Description

@tom-railpod

Versions:
rabbitpy 0.27.1
RabbitMQ 3.2.4. on ubuntu 14.04.4

The failure was caused by a connection with only consumers (without an ACK).
This resulted in no back traffic from the consumer to rabbitmq. After the
the timeout period, rabbitmq closed the socket and the consumer died.

Note: As a prior workaround, the connection was created with a timeout of 0
which should have turned off the timeout. rabbitmq appeared not to honor
this as the timeout was listed as 520 seconds.

The fix was to a single rabbitpy file: channel0.py. It was altered to
construct and send a heartbeat message back to rabbitmq on the timeout
interval.

The production GitHub repo of rabbitpy 0.27.1 (https://github.com/gmr/rabbitpy)
was forked to:
(https://github.com/tom-railpod/rabbitpy)
and the changes were made to a single file (channel0.py)

The only enhancement I might suggest is to only send the heartbeat
if there is no data has been recently sent back to rabbitmq. I
was under production delivery pressure so could not adequately
pursue this. On brief examination, I didn't find a "num_of_bytes_sent"
counter and didn't really have a way to test it. There is probably
no performance issue with the code as is.

I've generated a pull request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions