RPi hangs/freezes after running a few days

Hi, I've done a Node-red code for a home automated ventilation system - that freezes after running a few days :frowning:

I have tested changing the update interval of some of my nodes (data reads and date/time updates etc.) - I did a change of all data being updated every second to all data being updated less often - I think 10secs - that upped the run time from approx a day to a few days. However, it still freezes eventually.
Its as if the UI dashboard cannot be loaded, or seems to load as a blank page..

Its a RasPi 4. I have monitored memory, which seems to be consistently way below the 4Gigs of RAM. I have added a (noisy) fan and opened the case, keeping temps low at 30degree celcius.
However, it still freezes eventually...

I am quite frustrated by this... I have no clue what cause this behaviour.
Does anyone have ideas as to what may cause this?

The flows are uploaded in this thread where I got some help for the coding side of things:
(The right logic for this task)


Is it just the dashboard that won't load or will the editor not load either?
When it freezes what do you see if you run
How do you recover?
How did you install node-red?


and copy/paste the results here, that will tell us what versions of tools you are using.


What brand and size of SD card do you use?
what does df -h show

1 Like

I'll get back to you with info from the Pi.
The dashboard loads, but is veeeeery slow or unresponsive.
Loads better on my laptop than on my phone..
Editor loads, and are less unresponsive

And the code that I'm running seems to be working and running in the background...

That would be my first check too. Running out of disk space seems quite common, especially when there is an issue somewhere and the associated log files starts gobbling up SD card storage.

Have you got any charts running in the dashboard? If so then what time period or number of points are they configured for (that is in the chart config), and at what rate are they being given data? Also how many lines are there on the chart(s)?

Sd card is 16GB

Charts are max 8hrs, and some are given input every 10secs, but most every 10min.

its weird since the editor works quite fine... just the dashboard that is incredibly slow or nonresponsive... :thinking:

I have these three dashboard tabs running..

@FarfarGoHai what is the answer to this Jes?

Chart on processor card is not optimized at all. Such will harm dashboard performance for sure. Probably the other 24h chart (memory) can also have a bit less datpoints.

To prove whether it is the charts add and Inject node configured to clear the charts by sending an empty array to all the charts (or separate ones for each chart if you prefer). If clicking that restores the performance then you know it is the charts.

ok, here goes straight from my Rpi browser.

12 Oct 11:24:49 - [error] [function:ah_OnOff] TypeError: Cannot read property 'payload' of undefined
12 Oct 11:24:59 - [error] [function:ah_OnOff] TypeError: Cannot read property 'payload' of undefined
Start Node-RED
Once Node-RED has started, point a browser at
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
To find more nodes and example flows - go to http://flows.nodered.org
Starting as a systemd service.
12 Oct 11:32:23 - [info]
Welcome to Node-RED
12 Oct 11:32:23 - [info] Node-RED version: v0.20.7
12 Oct 11:32:23 - [info] Node.js  version: v10.16.3
12 Oct 11:32:23 - [info] Linux 4.19.46-v7l+ arm LE
12 Oct 11:32:24 - [info] Loading palette nodes
12 Oct 11:32:26 - [info] Dashboard version 2.16.2 started at /ui
12 Oct 11:32:26 - [info] Settings file  : /home/pi/.node-red/settings.js
12 Oct 11:32:26 - [info] Context store  : 'default' [module=memory]
12 Oct 11:32:26 - [info] User directory : /home/pi/.node-red
12 Oct 11:32:26 - [warn] Projects disabled : editorTheme.projects.enabled=false
12 Oct 11:32:26 - [info] Flows file     : /home/pi/.node-red/flows_tonsgaardRasPi.json
12 Oct 11:32:27 - [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.
12 Oct 11:32:27 - [info] Starting flows
12 Oct 11:32:27 - [info] Started flows
12 Oct 11:32:27 - [info] Server now running at
12 Oct 11:32:27 - [error] [function:ah_OnOff] TypeError: Cannot read property 'payload' of undefined
12 Oct 11:32:37 - [error] [function:ah_OnOff] TypeError: Cannot read property 'payload' of undefined
df -h:
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        13G  4.7G  7.5G  39% /
devtmpfs        1.8G     0  1.8G   0% /dev
tmpfs           2.0G  136M  1.8G   7% /dev/shm
tmpfs           2.0G  8.6M  1.9G   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mmcblk0p6  253M   40M  213M  16% /boot
tmpfs           391M     0  391M   0% /run/user/1000

does that provide any clues to people cleverer than me..

Try this, disconnect the wire to all of your graphs and deploy. Does that change anything?
If so, add the graphs in one at a time and redeploy after each is wired up. At some point the problem should show up letting you know where the culprit is.

I suggest you sort that one out first.