Node Red unexpected restart

Hi there,
multiple times and randomly per week, node red restarts.
I found in my log this events:

Sep  2 16:07:30 173 Node-RED[2835544]: 2 Sep 16:07:30 - [error] [s7 endpoint:Presse 6] Error: connect EHOSTUNREACH 192.168.130.96:102
Sep  2 16:07:31 173 Node-RED[2835544]: 2 Sep 16:07:31 - [error] [s7 endpoint:Presse 4] Error: connect EHOSTUNREACH 192.168.130.92:102
Sep  2 16:07:34 173 Node-RED[2835544]: 2 Sep 16:07:34 - [error] [s7 endpoint:Presse 10] Error: connect EHOSTUNREACH 192.168.130.104:102
Sep  2 16:07:35 173 Node-RED[2835544]: 2 Sep 16:07:35 - [error] [s7 endpoint:WD1] Error: connect EHOSTUNREACH 192.168.130.131:102
Sep  2 16:07:35 173 Node-RED[2835544]: 2 Sep 16:07:35 - [error] [s7 endpoint:Dampfsteuerung] Error: Timeout connecting to the transport
Sep  2 16:07:37 173 Node-RED[2835544]: 2 Sep 16:07:37 - [error] [s7 endpoint:Motan] Error: connect EHOSTUNREACH 192.168.130.125:102
Sep  2 16:07:38 173 Node-RED[2835544]: 2 Sep 16:07:38 - [error] [s7 endpoint:Presse 7] Error: connect EHOSTUNREACH 192.168.130.100:102
Sep  2 16:07:38 173 Node-RED[2835544]: 2 Sep 16:07:38 - [red] Uncaught Exception:
Sep  2 16:07:38 173 Node-RED[2835544]: 2 Sep 16:07:38 - [error] Error: read ECONNRESET
Sep  2 16:07:38 173 Node-RED[2835544]:    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
Sep  2 16:07:38 173 systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
Sep  2 16:07:38 173 systemd[1]: nodered.service: Failed with result 'exit-code'.
Sep  2 16:07:58 173 systemd[1]: nodered.service: Service RestartSec=20s expired, scheduling restart.
Sep  2 16:07:58 173 systemd[1]: nodered.service: Scheduled restart job, restart counter is at 1.
Sep  2 16:07:58 173 systemd[1]: Stopped Node-RED graphical event wiring tool.
Sep  2 16:07:58 173 systemd[1]: Started Node-RED graphical event wiring tool.
Sep  2 16:07:59 173 Node-RED[3457012]: 2 Sep 16:07:59 - [info]
Sep  2 16:07:59 173 Node-RED[3457012]: Welcome to Node-RED
Sep  2 16:07:59 173 Node-RED[3457012]: ===================
Sep  2 16:07:59 173 Node-RED[3457012]: 2 Sep 16:07:59 - [info] Node-RED version: v4.0.2
Sep  2 16:07:59 173 Node-RED[3457012]: 2 Sep 16:07:59 - [info] Node.js  version: v18.20.2
Sep  2 16:07:59 173 Node-RED[3457012]: 2 Sep 16:07:59 - [info] Linux 5.15.149-1-pve x64 LE
Sep  2 16:07:59 173 Node-RED[3457012]: 2 Sep 16:07:59 - [info] Loading palette nodes
Sep  2 16:08:02 173 Node-RED[3457012]: 2 Sep 16:8:2 - [s7comm-Error] - Installation of Module net-keepalive failed because we might be on the wrong OS. OS=linux
Sep  2 16:08:02 173 Node-RED[3457012]: 2 Sep 16:8:2 - [s7comm-Info] - Debug configuration for logLevelNodeS7:{"debug":0,"silent":true}
Sep  2 16:08:02 173 Node-RED[3457012]: 2 Sep 16:8:2 - [s7comm-Info] - Debug configuration for logLevelNodeRED:{"debug":2,"silent":true}
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] Dashboard version 3.6.5 started at /ui
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [error] [uibuilder:package-mgt:writePackageJson] Failed to copy package.json to backup.  /root/.node-red/uibuilder
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] Settings file  : /root/.node-red/settings.js
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] Context store  : 'default' [module=memory]
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] User directory : /root/.node-red
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [warn] Projects disabled : editorTheme.projects.enabled=false
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] Flows file     : /root/.node-red/flows.json
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] Server now running at http://127.0.0.1:1880/
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [warn]
Sep  2 16:08:04 173 Node-RED[3457012]: ---------------------------------------------------------------------
Sep  2 16:08:04 173 Node-RED[3457012]: Your flow credentials file is encrypted using a system-generated key.
Sep  2 16:08:04 173 Node-RED[3457012]: If the system-generated key is lost for any reason, your credentials
Sep  2 16:08:04 173 Node-RED[3457012]: file will not be recoverable, you will have to delete it and re-enter
Sep  2 16:08:04 173 Node-RED[3457012]: your credentials.
Sep  2 16:08:04 173 Node-RED[3457012]: You should set your own key using the 'credentialSecret' option in
Sep  2 16:08:04 173 Node-RED[3457012]: your settings file. Node-RED will then re-encrypt your credentials
Sep  2 16:08:04 173 Node-RED[3457012]: file using your chosen key the next time you deploy a change.
Sep  2 16:08:04 173 Node-RED[3457012]: ---------------------------------------------------------------------
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] +-----------------------------------------------------
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] | uibuilder v6.8.2 initialised đź“—
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] | root folder: /root/.node-red/uibuilder
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] | Using Node-RED's webserver at:
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] |   http://0.0.0.0:1880/
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] | Installed packages:
Sep  2 16:08:04 173 Node-RED[3457012]: 2 Sep 16:08:04 - [info] +-----------------------------------------------------
Sep  2 16:08:05 173 Node-RED[3457012]: 2 Sep 16:08:05 - [info] Starting flows

The s7 endpoint errors at the beginning are shown, because the S7 devices are switched off (offline)

My focus is on this lines:

Sep  2 16:07:38 173 Node-RED[2835544]: 2 Sep 16:07:38 - [red] Uncaught Exception:
Sep  2 16:07:38 173 Node-RED[2835544]: 2 Sep 16:07:38 - [error] Error: read ECONNRESET
Sep  2 16:07:38 173 Node-RED[2835544]:    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)

Can someone give me please some hints for the next steps to solve the problem of the unwanted restart of node red?

Thanks and all the best, Frank

This is a bug in S7 nodes:

= Search results for 'S7 TCP.onStreamRead order:latest' - Node-RED Forum
= ECONNRESET when PLC connection drops · Issue #91 · st-one-io/node-red-contrib-s7 · GitHub

In short, if the author of a node does not handle exceptions it can crash the node process.

You could add to the issue in the hope the author fixes the node.

Thanks a lot. Will do this.
It was only important for me, that there is no issue with Node Red.

Please also see if you can update to the latest version of uibuilder (noting the possible breaking changes). Hopefully, it should help get rid of that uibuilder error.

Yes, still done, uibuilder error now gone.
Have also installed net-keepalive which was declared as an error.
Waiting what happens next time.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.