postwait / node-amqp

[UNMAINTAINED] node-amqp is an AMQP client for nodejs
MIT License
1.69k stars 357 forks source link

Consumer loses connection with the Server #369

Closed jasonholzbach closed 9 years ago

jasonholzbach commented 9 years ago

amqp 0.2.0 rabbitMQ 3.3.5 and 3.4.1 node 0.10.26

We have a three machine setup (redhat linux virtual machines) with the rabbitMQ server on one machine, a producer on one machine and a consumer on one machine. We are using a fanout type of exchange. The producers are created when a message is ready to be produced, place the message on the queue, and then are terminated. The consumers listen for messages using addQueueListener until there is a message, then one processes it and terminates (and we have an automatic regeneration of a new consumer process). All works fine when we kick off the processes - the producer produces message and the consumer consumes them.

If we allow the consumer to sit idle for a little while (close to an hour or so always seems to work) and then produce a message, the consumer will become unresponsive to messages on the queue (we can see it on the queue in the rabbitMQ admin). When we put the rabbitMQ server on the same box as the consumers, everything works fine as far as we can tell. Because of this, I figure the network is terminating the connection and neither the server or consumer knows that it has been cutoff, so I added a heartbeat. At first I added it to the consumer exchange options (heartbeat : 60 - even reduced it to 10), yet it still occurred. So I went into the server and enabled the heartbeat on the server (rabbitmq.config file) and made it 90 seconds, yet it does not appear to help matters, the consumer still loses connection with the server after an extended idle time. I would have though the heartbeat would keep the connection alive. Is my understanding of the heartbeat is correct, and if so, is there a problem with it?