G
G
guerrrka2020-08-21 17:12:19
Node.js
guerrrka, 2020-08-21 17:12:19

Why is the imap connection dropping?

For the second night in a row, the Telegram bot crashes, which, on command, searches for a letter and displays the necessary information from it. To work with imap I use imap-simple .

Log
2020-08-21T02:34:49: Error: This socket has been ended by the other party
2020-08-21T02:34:49:     at Socket.writeAfterFIN [as write] (net.js:452:14)
2020-08-21T02:34:49:     at JSStreamSocket.doWrite (internal/js_stream_socket.js:170:19)
2020-08-21T02:34:49:     at JSStream.onwrite (internal/js_stream_socket.js:28:57)
2020-08-21T02:34:49:     at TLSSocket.Socket._final (net.js:415:28)
2020-08-21T02:34:49:     at callFinal (_stream_writable.js:609:10)
2020-08-21T02:34:49:     at processTicksAndRejections (internal/process/task_queues.js:84:21) {
2020-08-21T02:34:49:   code: 'EPIPE',
2020-08-21T02:34:49:   source: 'socket'
2020-08-21T02:34:49: }
2020-08-21T02:34:52: ConnectionTimeoutError: connection timed out. timeout = 2000 ms
2020-08-21T02:34:52:     at Connection.imapOnError (/home/asupportsdev/node_modules/imap-simple/lib/imapSimple.js:610:23)
2020-08-21T02:34:52:     at Object.onceWrapper (events.js:417:26)
2020-08-21T02:34:52:     at Connection.emit (events.js:310:20)
2020-08-21T02:34:52:     at Timeout._onTimeout (/home/asupportsdev/node_modules/imap/lib/Connection.js:141:12)
2020-08-21T02:34:52:     at listOnTimeout (internal/timers.js:549:17)
2020-08-21T02:34:52:     at processTimers (internal/timers.js:492:7)
2020-08-21T02:34:56: ConnectionTimeoutError: connection timed out. timeout = 2000 ms
2020-08-21T02:34:56:     at Connection.imapOnError (/home/asupportsdev/node_modules/imap-simple/lib/imapSimple.js:610:23)
2020-08-21T02:34:56:     at Object.onceWrapper (events.js:417:26)
2020-08-21T02:34:56:     at Connection.emit (events.js:310:20)
2020-08-21T02:34:56:     at Timeout._onTimeout (/home/asupportsdev/node_modules/imap/lib/Connection.js:141:12)
2020-08-21T02:34:56:     at listOnTimeout (internal/timers.js:549:17)
2020-08-21T02:34:56:     at processTimers (internal/timers.js:492:7)
2020-08-21T02:35:00: ConnectionTimeoutError: connection timed out. timeout = 2000 ms
2020-08-21T02:35:00:     at Connection.imapOnError (/home/asupportsdev/node_modules/imap-simple/lib/imapSimple.js:610:23)
2020-08-21T02:35:00:     at Object.onceWrapper (events.js:417:26)
2020-08-21T02:35:00:     at Connection.emit (events.js:310:20)
2020-08-21T02:35:00:     at Timeout._onTimeout (/home/asupportsdev/node_modules/imap/lib/Connection.js:141:12)
2020-08-21T02:35:00:     at listOnTimeout (internal/timers.js:549:17)
2020-08-21T02:35:00:     at processTimers (internal/timers.js:492:7)
2020-08-21T02:35:03: ConnectionTimeoutError: connection timed out. timeout = 2000 ms
2020-08-21T02:35:03:     at Connection.imapOnError (/home/asupportsdev/node_modules/imap-simple/lib/imapSimple.js:610:23)
2020-08-21T02:35:03:     at Object.onceWrapper (events.js:417:26)
2020-08-21T02:35:03:     at Connection.emit (events.js:310:20)
2020-08-21T02:35:03:     at Timeout._onTimeout (/home/asupportsdev/node_modules/imap/lib/Connection.js:141:12)
2020-08-21T02:35:03:     at listOnTimeout (internal/timers.js:549:17)
2020-08-21T02:35:03:     at processTimers (internal/timers.js:492:7)
2020-08-21T02:35:07: ConnectionTimeoutError: connection timed out. timeout = 2000 ms
2020-08-21T02:35:07:     at Connection.imapOnError (/home/asupportsdev/node_modules/imap-simple/lib/imapSimple.js:610:23)
2020-08-21T02:35:07:     at Object.onceWrapper (events.js:417:26)
2020-08-21T02:35:07:     at Connection.emit (events.js:310:20)
2020-08-21T02:35:07:     at Timeout._onTimeout (/home/asupportsdev/node_modules/imap/lib/Connection.js:141:12)
2020-08-21T02:35:07:     at listOnTimeout (internal/timers.js:549:17)
2020-08-21T02:35:07:     at processTimers (internal/timers.js:492:7)
2020-08-21T02:35:11: ConnectionTimeoutError: connection timed out. timeout = 2000 ms
2020-08-21T02:35:11:     at Connection.imapOnError (/home/asupportsdev/node_modules/imap-simple/lib/imapSimple.js:610:23)
2020-08-21T02:35:11:     at Object.onceWrapper (events.js:417:26)
2020-08-21T02:35:11:     at Connection.emit (events.js:310:20)
2020-08-21T02:35:11:     at Timeout._onTimeout (/home/asupportsdev/node_modules/imap/lib/Connection.js:141:12)
2020-08-21T02:35:11:     at listOnTimeout (internal/timers.js:549:17)
2020-08-21T02:35:11:     at processTimers (internal/timers.js:492:7)
2020-08-21T02:36:51: Error: This socket has been ended by the other party
2020-08-21T02:36:51:     at Socket.writeAfterFIN [as write] (net.js:452:14)
2020-08-21T02:36:51:     at JSStreamSocket.doWrite (internal/js_stream_socket.js:170:19)
2020-08-21T02:36:51:     at JSStream.onwrite (internal/js_stream_socket.js:28:57)
2020-08-21T02:36:51:     at TLSSocket.Socket._final (net.js:415:28)
2020-08-21T02:36:51:     at callFinal (_stream_writable.js:609:10)
2020-08-21T02:36:51:     at processTicksAndRejections (internal/process/task_queues.js:84:21) {
2020-08-21T02:36:51:   code: 'EPIPE',
2020-08-21T02:36:51:   source: 'socket'
2020-08-21T02:36:51: }

Yesterday's log is identical, the time is approximately the same - 03:53:05. It is embarrassing that this phenomenon occurs once a day, and it is at night when the bot is not used by anyone. After each error, PM2 reloaded the script, but the Imap connection did not recover until a manual reload.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question