A lot of my node.js processes are crashing with the ECONNRESET error. Here’s the output I can see:
node.js:50
throw e;
^
Error: ECONNRESET, Connection reset by peer
at Client._readImpl (net:320:14)
at IOWatcher.callback (net:470:24)
at node.js:607:9
Does anyone know how to handle this? It’s not a very useful stack trace so I have no idea where it’s happening. Should I just wrap any and all access to a remote source via http with a try/catch block? Or is there a better way?
In general I don’t care if this does happen or if some task does not get completed because of this. What I do care about is that the process should just shrug it off and work on the next task.
You need to attach to the error Event for your socket. If you don’t, then the default action is to throw an exception when an error occurs.