postwait / node-amqp

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

Reconnection logic does not work if TCP connection closes #306

Open mrjoes opened 10 years ago

mrjoes commented 10 years ago

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:

  1. Run this server
var amqp = require('amqp');
var conn = amqp.createConnection('amqp://localhost');
conn.on('ready', function() {
  console.log('ready!');
});
setInterval(function() {}, 1000);
  1. Let it connect to RabbitMQ
  2. Shutdown RabbitMQ by killing its process
  3. Start RabbitMQ
  4. 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);
});
bicubic commented 10 years ago

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.

zeusdeux commented 10 years ago

@mrjoes I am using the same workaround. But in my case it's leaking channels. Is it doing the same for you?

dankle commented 9 years ago

I'm having the same problem, any updates on this issue?