-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection.end() causes an emit of ECONNRESET #300
Comments
+1, same here |
I am getting the same error, however, it's limited to only the servers in my prod environment. My local environment, dev, and stage all work fine. However, it's 100% reproducible on the prod servers. The interesting thing is that they all have the same server setup (except my local env). I have tried using the latest stable version of the node-amqp library (that does not include the explicit After using node-inspector to step through the entire execution flow (very, very tediously) I still could not figure out exactly why it was throwing the ECONNRESET error. The If I use netstat to see how many sockets are open to the rabbit server I can see that the socket has not been closed, so eventually rabbit starts blocking the connections as my node-pool continues to create new connections (thinking the old ones were closed properly). I've been able to fix the ECONNRESET error by modifying the call to Here is some information on the environment where this issue happens: OS: Debian Squeeze (v6.0.8) |
I have a similar issue using node v0.10.X but it disappears if I use node 0.8. I am not saying this is a solution, but... |
+1 for this issue on CentOS 6.3, Node 0.10.22, RabbitMQ 3.2.3, node-amqp v0.1.8. Also, I did not get the error on my development machine, which is a Mac OS Mavericks installation with same configurations otherwise. |
@theartoflogic: you should be aware that socket.destroy() does not actually end the connection. I tried to use @glenjamin 's |
@rafaelkaufmann the I'm not sure why it wouldn't work for you, but I'd chalk it up to the weirdness of this bug in general. It seems to vary under what circumstances it happens, and it seems that it varies under which conditions it's "fixed" as well. For now, it's working for me and that's the most important thing. I'm still hoping for an actual fix for it though. I just wanted to present my findings as far as what worked for me in case it can help anyone else in the short term. |
That's truly bizarre @theartoflogic. Thanks for sharing. 👍 |
It seems that RabbitMQ responds to TCP FIN packet with RST packet:
It happens no matter if the node-amqp is from master, or from #248. It can either be a bug or working-as-intented on RabbitMQ side. I would file a bug upstream, but no idea where their bug tracker is (mailing list?) |
My branch doesn't stop other bits of the system from trying to send data once the socket is closed - I was a bit lazy there. Say you have a continuous publish(), then you trigger a close - the publish that happens after socket.end() / connectionCloseOk will cause the exception described above. Possible Solutions:
|
@glenjamin, I wound up fleeing from the problem :) Meaning I refactored my app to be less dependent on the details of connection management... |
@glenjamin it is not problem of app sending data after close. It seems that RabbitMQ responds (on TCP level) with RST to client's FIN. I did some tracing, and there is no packet sent to RabbitMQ after amqp's Close. RST may be intentional, i.e. RabbitMQ does not wish to do full for way close, but cuts the connection short with RST. If that is the case, then probably something should handle and quiet ECONNRESET after closeOk is received. |
Issue #300: connection.end() causing ECONNRESET
test/test-basic-return.js: Error: read ECONNRESET
|
When I run some of the tests, e.g
node test/test-basic-return.js
I get
It seems it is connected to #295 and #246, however the code from #248 does not solve it.
It is a hell of a bug, because it caused me to look for a few hours for a bug in exchange.publish, and then it turned out it is some networking stuff happening upon
connection.end()
.The text was updated successfully, but these errors were encountered: