node-amqp
node-amqp copied to clipboard
Reconnection logic does not work if TCP connection closes
Reconnection logic implemented in #236 does not cover case when TCP connection to the server getting closed as a result of server crash.
Steps to reproduce:
- Run this server
var amqp = require('amqp');
var conn = amqp.createConnection('amqp://localhost');
conn.on('ready', function() {
console.log('ready!');
});
setInterval(function() {}, 1000);
- Let it connect to RabbitMQ
- Shutdown RabbitMQ by killing its process
- Start RabbitMQ
- Client won't reconnect and 'ready!' won't be displayed
For now, I'm using this workaround (it is server software, so I need persistent connection to RabbitMQ):
conn.on('end', function() {
setTimeout(function() {
conn.reconnect();
}, 1000);
});
I've been stuck on this issue for a while, can definitely confirm. This makes it impossible to maintain a persistent connection for long periods of time, and in turn makes this library unsuitable for real world applications. I hope this gets priority.
@mrjoes I am using the same workaround. But in my case it's leaking channels. Is it doing the same for you?
I'm having the same problem, any updates on this issue?