node-amqp icon indicating copy to clipboard operation
node-amqp copied to clipboard

Unhandled connection error: CONNECTION_FORCED - broker forced connection closure with reason 'shutdown'

Open simonmorley opened this issue 10 years ago • 4 comments

We've got a number of rabbit servers behind haproxy. We've been running into deployment issues recently since our chef run generally restarts one or more of the servers on each run.

This causes a previously discussed error on our nodejs listeners:

Unhandled connection error: CONNECTION_FORCED - broker forced connection closure with reason 'shutdown'

Which seems reasonable considering a server's been shutdown.

Within connection.js lines 484 - 491, we changed the following line:

this.socket.destroy(e);

To

this.socket.destroy(e)
this.connect()

We've already set reconnect to true but that doesn't seem to have any impact on the situation.

The botch (seems to) work really nicely for us. I can kill all my servers and amqp reconnects each time.

Am just wondering if anyone views this as:

  • Totally ridiculous
  • A botch for sure but workable
  • A really great idea that could be considered

Ref: https://github.com/postwait/node-amqp/blob/9138d83bf33702693025b2351b1780057307d4ff/lib/connection.js#L484-L491

simonmorley avatar Jun 28 '14 13:06 simonmorley

I reproduce the same. Anyone working on this?

dolftax avatar Nov 13 '15 07:11 dolftax

Also faced this issue, when we had to failover our rabbit cluster.

zcei avatar Dec 21 '15 15:12 zcei

I have the same problem too.any way to solve this??

ghost avatar Dec 26 '17 11:12 ghost

@tyan4g I've had similar issues with node-amqp, thus moved on to https://github.com/squaremo/amqp.node. Been using it for almost an year now in production and no issues. Also, the patterns are much more cleaner.

PS: I do not mean to say this package isn't stable/clear. Its just my experience.

dolftax avatar Dec 26 '17 17:12 dolftax