postwait / node-amqp

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

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

Open simonmorley opened 10 years ago

simonmorley commented 10 years ago

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:

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

dolftax commented 8 years ago

I reproduce the same. Anyone working on this?

zcei commented 8 years ago

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

ghost commented 6 years ago

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

dolftax commented 6 years ago

@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.