I installed two times nodeRed (using dockers). On installation was on a test PI 3 and the other on productive PI 4. Both are same image with Bullseye.
On my test PI 3, everything went fine and is running since two weeks without any interruption.
After this successful test, I also installed it on my second PI. But unfortunately, after each 4-5 minutes, the flow stops. Even without any interaction, the flow stops (suddenly).
Even with logging on trace level, I couldn't find any additional information about it.
Do you have any hints for me?
ct-smart-home-nodered-1 | 1 Mar 06:08:27 - [info] [zigbee2mqtt-out:CUPBOARD-0] Published to mqtt topic: zigbee2mqtt/CupBoard/set : {"brightness":0}
ct-smart-home-nodered-1 | 1 Mar 06:10:02 - [info] Stopping flows
ct-smart-home-nodered-1 | 1 Mar 06:10:02 - [debug] red/nodes/flows.stop : stopping flow : a88cac3fd58ce8fe
ct-smart-home-nodered-1 | 1 Mar 06:10:02 - [trace] [flow:a88cac3fd58ce8fe] stop flow
ct-smart-home-nodered-1 | 1 Mar 06:10:02 - [trace] Stopping node mqtt in:841199a2dc8370ca
It looks like the node red was stopped and started for some reason. It didn't crash.
I did ask for the full log from start to stop.
Also can you look in /var/log/syslog and see what is there around 08:15, in case there is a clue there.
Also can you monitor the exact times that it restarts and see if there is a pattern please. I note that the first one you posted was at 06:10:02 and this one is at 08:15:02, which suggests that something is restarting it every five minutes. How are you starting node-red?
I am not an expert in docker, but it looks to me as if something is not right there. I think you need someone who knows about docker to tell us what is happening.
Follow output is coming from the native installation:
1 Mar 11:48:41 - [info] Linux 5.10.92-v8+ arm LE
1 Mar 11:48:43 - [info] Loading palette nodes
1 Mar 11:48:45 - [info] Settings file : /home/pi/.node-red/settings.js
1 Mar 11:48:45 - [info] Context store : 'default' [module=memory]
1 Mar 11:48:45 - [info] User directory : /home/pi/.node-red
1 Mar 11:48:45 - [warn] Projects disabled : editorTheme.projects.enabled=false
1 Mar 11:48:45 - [info] Flows file : /home/pi/.node-red/flows.json
1 Mar 11:48:45 - [info] Creating new flow file
1 Mar 11:48:45 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
1 Mar 11:48:45 - [info] Server now running at http://127.0.0.1:1880/
1 Mar 11:48:45 - [info] Starting flows
1 Mar 11:48:45 - [info] Started flows
1 Mar 11:50:01 - [info] Stopping flows
1 Mar 11:50:01 - [info] Stopped flows
nodered.service: Succeeded.
nodered.service: Consumed 6.647s CPU time.
syslog:
Mar 1 11:49:10 rasp02 dhcpcd[521]: wlan0: Router Advertisement from fe80::xxxxxxxxxxxx
Mar 1 11:50:01 rasp02 Node-RED[31159]: 1 Mar 11:50:01 - [info] Stopping flows
Mar 1 11:50:01 rasp02 Node-RED[31159]: 1 Mar 11:50:01 - [info] Stopped flows
Mar 1 11:50:01 rasp02 systemd[1]: nodered.service: Succeeded.
Please post the full output from (and including) the commands node-red-stop node-red-start
up to the first restart. Or does it not restart itself?
Notice again it stopped at exactly a five minute boundary. Have you got anything in the flows that does anything through the node red admin api? Have you got anything that runs every 5 minutes?
Once Node-RED has started, point a browser at http://172.17.0.69:1880
On Pi Node-RED works better with the Firefox or Chrome browser
Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot
Starting as a systemd service.
1 Mar 11:48:41 - [info]
Welcome to Node-RED
1 Mar 11:48:41 - [info] Node-RED version: v2.1.6
1 Mar 11:48:41 - [info] Node.js version: v12.22.5
1 Mar 11:48:41 - [info] Linux 5.10.92-v8+ arm LE
1 Mar 11:48:43 - [info] Loading palette nodes
1 Mar 11:48:45 - [info] Settings file : /home/pi/.node-red/settings.js
1 Mar 11:48:45 - [info] Context store : 'default' [module=memory]
1 Mar 11:48:45 - [info] User directory : /home/pi/.node-red
1 Mar 11:48:45 - [warn] Projects disabled : editorTheme.projects.enabled=false
1 Mar 11:48:45 - [info] Flows file : /home/pi/.node-red/flows.json
1 Mar 11:48:45 - [info] Creating new flow file
1 Mar 11:48:45 - [warn]
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
1 Mar 11:48:45 - [info] Server now running at xxxxxfadf:1880/
1 Mar 11:48:45 - [info] Starting flows
1 Mar 11:48:45 - [info] Started flows
1 Mar 11:50:01 - [info] Stopping flows
1 Mar 11:50:01 - [info] Stopped flows
nodered.service: Succeeded.
nodered.service: Consumed 6.647s CPU time.
root@raps02:~# cat /lib/systemd/system/nodered.service
# systemd service file to start Node-RED
[Unit]
Description=Node-RED graphical event wiring tool
Wants=network.target
Documentation=http://nodered.org/docs/hardware/raspberrypi.html
[Service]
Type=simple
# Run as normal pi user - change to the user name you wish to run Node-RED as
User=pi
Group=pi
WorkingDirectory=/home/pi
Environment="NODE_OPTIONS=--max_old_space_size=512"
# define an optional environment file in Node-RED's user directory to set custom variables externally
EnvironmentFile=-/home/pi/.node-red/environment
# uncomment and edit next line if you need an http proxy
#Environment="HTTP_PROXY=my.httpproxy.server.address"
# uncomment the next line for a more verbose log output
#Environment="NODE_RED_OPTIONS=-v"
# uncomment next line if you need to wait for time sync before starting
#ExecStartPre=/bin/bash -c '/bin/journalctl -b -u systemd-timesyncd | /bin/grep -q "systemd-timesyncd.* Synchronized to time server"'
ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS
#ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS
# Use SIGINT to stop
KillSignal=SIGINT
# Auto restart on crash
Restart=on-failure
RestartSec=20
# Tag things in the log
SyslogIdentifier=Node-RED
#StandardOutput=syslog
[Install]
WantedBy=multi-user.target
root@raps02:~#
Admin edit, added triple backticks round the file to make it easier to read.
That looks ok. One think that confuses me, I got the impression that this was a new installation, yet it is not using the latest version of node-red. The recommended install method would have installed the latest version.
I also notice that you have setup at least one other user and also the root account, which is not generally recommended. I wonder if the problem is something to do with other changes that have been made.
Would it be possible to create a fresh install of Pi OS on a new card, install node red using the recommended method and checking that there is no problem with that? Then we will know if it is something to do with your OS setup. Though I have no idea what.