jcreigno / nodejs-mail-notifier

nodejs library to listen incoming mail
MIT License
168 stars 77 forks source link

This error is thrown sporadically when services has been active for awhile #49

Closed Jbone187 closed 5 years ago

Jbone187 commented 6 years ago

throw er; // Unhandled 'error' event ^

Error: socket hang up at TLSSocket.onHangUp (_tls_wrap.js:1135:19) at Object.onceWrapper (events.js:313:30) at emitNone (events.js:111:20) at TLSSocket.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1055:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)

jmealo commented 6 years ago

@Jbone187 Have you attached a listener to error? It seems like you're intended to add your own reconnect logic there. I believe the emitNone in the stack trace may mean that no error handler was registered.

Either way, there needs to be a way for you to catch that throw to handle reconnect logic.

Jbone187 commented 6 years ago

After looking over the error again I think this error is related to the https module I am using. Sorry for the inconveniences

jmealo commented 6 years ago

@Jbone187 Thanks for following up. Do you mind closing the issue?

Jbone187 commented 6 years ago

Go ahead and close

giacomobartoli commented 4 years ago

@Jbone187 I am experiencing the same issue. Could you kindly provide some hints about how did you solve it?

Jbone187 commented 4 years ago

@giacomobartoli I just threw a try catch in there to catch the error so it wouldn't kill the process. It was happening due to network issue with my mail server and when it couldn't communicate it was throwing that error in my situation. Hope this help some

giacomobartoli commented 4 years ago

@Jbone187 thank you for the quick answer. I just realized that I was not handling the 'end' event within the email-listener. So now I am trying handle this event, but if it does not work I'll proceed with your suggestion.