Open Gilwyad opened 6 years ago
Same issue. When I call connection.disconnect()
I receive an error event.
Error: read ECONNRESET
at exports._errnoException (util.js:1020:11)
at TCP.onread (net.js:568:26)
I have a script that uses amqp and I need to terminate it after all processing is done. However, calling disconnect won't kill the amqp's even loop(?) so my script keeps running. Calling disconnect() doesn't seem to end the event loop in this case.
Same issue, calling disconnect()
will trigger reconnect()
so a new socket will open, this will cause mocha (>= 3.x) unit test cannot exit properly without --exit
A temporary way to fix this issue is to call
self.connection.setImplOptions({reconnect: false});
before
connection.disconnect()
Then, connection will be reconnected by disconnect()'s exception
hey guys, I have found a fix. According to my understanding,when we call disconnect it sends "client disconnect"
first and it receives "connectionCloseOk"
. On receiving the event, it first tries to call this.socket.end()
function which is throwing the and possible reason for that is socket is no more available to communicate with server.
The fix is comment out or remove this.socket.end()
and this.socket.destroy()
will automatically destroys the socket, which is what a client intends when it calls a disconnect function. Finally, it would look like this
case methods.connectionCloseOk:
debug && debug("Received close-ok from server, closing socket");
this.socket.destroy();
break;
As I am beginner, correct me if something is wrong with this,
Is there any update on this issue? I am still hit by this issue. (I am just killing the App manually at the end)
How should I cleanly disconnect while also handling errors?