node-imap icon indicating copy to clipboard operation
node-imap copied to clipboard

intermittent timeout errors throughout the day

Open dlandry-siesde opened this issue 4 years ago • 2 comments

We're using imap-simple (archived) to read & delete some emails from our dreamhost mailserver. Intermittently, we'll get timeout errors throughout the day. We'll sometimes get dozens of these errors in a day, and other times not any for weeks. These errors don't crash our node process.

Jul 29 12:36:11 ERR Error: Timed out while connecting to server
Jul 29 12:40:13 ERR Error: Timed out while connecting to server
Jul 29 12:40:13 ERR     at Timeout._onTimeout (/home/vcap/app/node_modules/imap/lib/Connection.js:280:15)
Jul 29 12:40:13 ERR     at listOnTimeout (internal/timers.js:554:17)
Jul 29 12:40:13 ERR     at processTimers (internal/timers.js:497:7) {
Jul 29 12:40:13 ERR   source: 'timeout'
Jul 29 12:40:13 ERR }
Jul 29 12:42:11 ERR Error: Timed out while connecting to server
Jul 29 12:42:11 ERR     at Timeout._onTimeout (/home/vcap/app/node_modules/imap/lib/Connection.js:280:15)
Jul 29 12:42:11 ERR     at listOnTimeout (internal/timers.js:554:17)
Jul 29 12:42:11 ERR     at processTimers (internal/timers.js:497:7) {
Jul 29 12:42:11 ERR   source: 'timeout'
Jul 29 12:42:11 ERR }
Jul 29 12:46:11 ERR     at Timeout._onTimeout (/home/vcap/app/node_modules/imap/lib/Connection.js:280:15)
Jul 29 12:46:11 ERR     at listOnTimeout (internal/timers.js:554:17)
Jul 29 12:46:11 ERR     at processTimers (internal/timers.js:497:7) {
Jul 29 12:46:11 ERR   source: 'timeout'
Jul 29 12:46:11 ERR }
Jul 29 12:46:11 ERR Error: Timed out while connecting to server
Jul 29 12:49:10 ERR Error: Timed out while connecting to server
Jul 29 12:49:10 ERR     at Timeout._onTimeout (/home/vcap/app/node_modules/imap/lib/Connection.js:280:15)
Jul 29 12:49:10 ERR     at listOnTimeout (internal/timers.js:554:17)
Jul 29 12:49:10 ERR     at processTimers (internal/timers.js:497:7) {
Jul 29 12:49:10 ERR   source: 'timeout'
Jul 29 12:49:10 ERR } 

I see node-imap throws these errors:

https://github.com/mscdex/node-imap/blob/867aa88a335a266b904e0271afa36f69af31a869/lib/Connection.js#L279-L284

And that imap-simple should be bubbling them through their connection object (permalink):

    // special handling for `error` event
    self.imap.on('error', function (err) {
        // if .end() has been called and an 'ECONNRESET' error is received, don't bubble
        if (err && self.ending && (err.code.toUpperCase() === 'ECONNRESET')) {
            return;
        }


        self.emit('error', err);
    });

We are listening to the imapSimple connection object for error events, but the handler isn't catching these errors.

Sorry if this is the wrong place for this question. imap-simple is archived, and these errors are originating from the imap dependency, so I decided to post here.

node: v12.21.0 imap: ^0.8.19

dlandry-siesde avatar Jul 29 '21 18:07 dlandry-siesde

Hi dlandry-siesde! Long time you wrote the issue but i am facing it at the moment, did you find any solution? Best

gcelma avatar Apr 26 '22 12:04 gcelma

did you find any solution?

mahua17 avatar May 31 '22 07:05 mahua17