Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am getting an unhandled error but not sure where it's coming from. My app has several http.request(options, callback).end() in different methods, with the callback's trapping "uncaughtException" and "error". I'd like to know which of my methods initiated this issue. Below is the error I get. It is random. Any ideas how to track this down? I was hoping for some global way of trapping unhandled errors.

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: read ECONNRESET
    at exports._errnoException (util.js:746:11)
    at TCP.onread (net.js:559:26)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.5k views
Welcome To Ask or Share your Answers For Others

1 Answer

ECONNRESET means that the other side of the TCP connection is aborted. You could look at the server logs, but since it was random times this makes me think that the server becomes overloaded and kills a few connections.

If you're starting a process at any point in the process try the below:

process.on('uncaughtException', function (err) {
  console.error(err.stack);
  console.log("Node NOT Exiting...");
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...