N8n in docker accidentally restarting

Hi @N8N_userN and @MutedJam

I’ve got a similar error. My self-hosted n8n is restarting every 3-5 minutes. And I also use the EmailReadImap node as a trigger. Actually, the error seems to origin there. This is my log that always looks like this before a restart:

2022-05-16T15:30:33.541Z | debug    | Received child process message of type processHook for execution ID 113026. {"executionId":"113026","file":"WorkflowRunner.js"}
2022-05-16T15:30:33.542Z | debug    | Executing hook (hookFunctionsSave) {"executionId":"113026","workflowId":14,"file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}
2022-05-16T15:30:33.543Z | debug    | Save execution data to database for execution ID 113026 {"executionId":"113026","workflowId":14,"finished":true,"stoppedAt":"2022-05-16T15:30:33.539Z","file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}
2022-05-16T15:30:33.548Z | debug    | Received child process message of type end for execution ID 113026. {"executionId":"113026","file":"WorkflowRunner.js"}
2022-05-16T15:30:33.552Z | debug    | Executing hook (hookFunctionsPush) {"executionId":"113026","workflowId":14,"file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}
2022-05-16T15:31:27.377Z | debug    | Wait tracker querying database for waiting executions {"file":"WaitTracker.js","function":"getwaitingExecutions"}
2022-05-16T15:32:24.589Z | verbose  | IMAP connection was reset - reconnecting. {"file":"EmailReadImap.node.js"}
2022-05-16T15:32:25.755Z | debug    | Querying for new messages on node "EmailReadImap" {"searchCriteria":["UNSEEN",["UID","10661:*"]],"file":"EmailReadImap.node.js","function":"onmail"}
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read',
  source: 'socket'
}
2022-05-16T15:32:35.932Z | info     | Initializing n8n process {"file":"start.js"}

Looking into the code, I cannot definitely say at what place the error happens, but it seems like there’s a uncaught promise rejection or something like that.

List of restart event
A B C
1
Event Timestamp WorkflowId
2
Manual execution
2022-05-16T15:53:13.481Z
15
3
Instance started
2022-05-16T16:06:44.003Z
15
4
Instance started
2022-05-16T16:11:08.541Z
15
5
Instance started
2022-05-16T16:15:11.628Z
15
6
Instance started
2022-05-16T16:19:03.928Z
15
7
Instance started
2022-05-16T16:23:00.532Z
15
8
Instance started
2022-05-16T16:27:18.928Z
15
9
Instance started
2022-05-16T16:31:31.122Z
15
10
Instance started
2022-05-16T16:35:47.900Z
15
11
Instance started
2022-05-16T16:39:09.979Z
15
12
Instance started
2022-05-16T16:42:46.407Z
15
13
Instance started
2022-05-16T16:46:29.995Z
15
14
Instance started
2022-05-16T16:50:02.713Z
15
15
Instance started
2022-05-16T16:54:02.402Z
15
16
Instance started
2022-05-16T16:58:05.584Z
15
17
Instance started
2022-05-16T17:01:59.295Z
15
18
Instance started
2022-05-16T17:06:01.578Z
15
19
Instance started
2022-05-16T17:09:54.164Z
15
20
Instance started
2022-05-16T17:13:55.303Z
15
21
Instance started
2022-05-16T17:17:56.457Z
15
22
Instance started
2022-05-16T17:21:51.049Z
15
23
Instance started
2022-05-16T17:25:13.805Z
15
24
Instance started
2022-05-16T17:28:53.648Z
15
25
Instance started
2022-05-16T17:32:49.666Z
15
26
Instance started
2022-05-16T17:36:56.553Z
15
27
Instance started
2022-05-16T17:40:29.223Z
15
28
Instance started
2022-05-16T17:43:53.252Z
15
29
Instance started
2022-05-16T17:47:18.967Z
15
30
Instance started
2022-05-16T17:51:32.594Z
15
31
Instance started
2022-05-16T17:55:37.239Z
15
32
Instance started
2022-05-16T17:59:17.790Z
15
33
Instance started
2022-05-16T18:03:31.816Z
15
34
Instance started
2022-05-16T18:07:08.361Z
15
35
Instance started
2022-05-16T18:11:19.787Z
15
36
Instance started
2022-05-16T18:14:55.229Z
15
37
Instance started
2022-05-16T18:18:51.241Z
15
38
Instance started
2022-05-16T18:22:52.141Z
15
39
Instance started
2022-05-16T18:26:25.269Z
15
40
Instance started
2022-05-16T18:30:07.316Z
15
41
Instance started
2022-05-16T18:33:56.986Z
15