Skip to content

Commit

Permalink
Added the fix suggested in postwait#300 to prevent econnreset.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Meerveld committed Jun 23, 2015
1 parent f64704d commit 5489797
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ Connection.prototype._onMethod = function (channel, method, args) {

case methods.connectionCloseOk:
debug && debug("Received close-ok from server, closing socket");
this.socket.end();
//this.socket.end(); this causes the ECONNRESET error, as per https://github.com/postwait/node-amqp/issues/300
this.socket.destroy();
break;

case methods.connectionBlocked:
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "name" : "amqp"
, "description" : "AMQP driver for node"
{ "name" : "dogeatdog-amqp"
, "description" : "AMQP driver for node with a fix for econnreset"
, "keywords" : [ "amqp" ]
, "version" : "0.2.4"
, "version" : "0.2.4.dogeatdog"
, "author" : { "name" : "Ryan Dahl" }
, "contributors" :
[ { "name" : "Vasili Sviridov" }
Expand All @@ -19,13 +19,14 @@
, { "name" : "David Barshow" }
, { "name" : "Jason Pincin" }
, { "name" : "Carl Hörberg" }
, { "name" : "Dennis Meerveld" }
]
, "repository" :
{ "type" : "git"
, "url" : "git://github.com/postwait/node-amqp.git"
, "url" : "git://github.com/dogeatdog/node-amqp.git"
}
, "bugs" :
{ "url" : "http://github.com/postwait/node-amqp/issues"
{ "url" : "http://github.com/dogeatdog/node-amqp/issues"
}
, "main" : "./amqp"
, "engines" : { "node" : "0.4 || 0.6 || 0.8 || 0.9 || 0.10 || 0.11 || 0.12" }
Expand Down

2 comments on commit 5489797

@seansullivan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you ever work on a pull request to get this merged into the postwait/node-amqp project. I just made the same change you have in this commit and it fixed the ECONNRESET error I was seeing as well.

@seansullivan
Copy link

@seansullivan seansullivan commented on 5489797 Jan 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some more digging (referencing the Node.js docs), calling .end() on the socket is preferrable, as the connectionCloseOk case is currently set to do. This ECONNRESET error looks like it's coming from RabbitMQ as part of their socket implementation.

I am going to proceed with 0.2.6 of the postwait library and suppress the ECONNRESET when I know that I have closed the socket from my end.

Please sign in to comment.