I have successfully installed and run Node-RED on many Raspberry Pi systems to date, however my latest install has shown strange CPU activity at start-up.
Following start-up of a clean system build, with no other programmes, no extra nodes and no flows, initially top shows node-red ~200% CPU and 7.0% MEM then after around four minutes it drops to 0.0% CPU and 7.0% MEM. The same high / low sequence occurs every time the system is booted up.
Hardware : Raspberry Pi 3 Model B Plus Rev 1.3
OS : Linux 11 (bullseye) / 32 bit
Node-RED Core : 3.1.0
Node : v18.18.0
Npm : 9.8.1
the image was flashed using Raspberry Pi Imager v1.7.4 (I have tried with both HDD and SD - same result).
I am no expert, but syslog does not seem to show any issues. A filtered dump using COMMAND=Node-RED looks normal to me...
Oct 10 13:04:52 Apollo systemd[1]: Started Node-RED graphical event wiring tool.
Oct 10 13:04:57 Apollo Node-RED[359]: 10 Oct 13:04:57 - [info]
Oct 10 13:04:58 Apollo Node-RED[359]: Welcome to Node-RED
Oct 10 13:04:58 Apollo Node-RED[359]: ===================
Oct 10 13:04:58 Apollo Node-RED[359]: 10 Oct 13:04:57 - [info] Node-RED version: v3.1.0
Oct 10 13:04:58 Apollo Node-RED[359]: 10 Oct 13:04:57 - [info] Node.js version: v18.18.0
Oct 10 13:04:58 Apollo Node-RED[359]: 10 Oct 13:04:57 - [info] Linux 6.1.21-v7+ arm LE
Oct 10 13:05:01 Apollo Node-RED[359]: 10 Oct 13:05:01 - [info] Loading palette nodes
Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Settings file : /home/pi/.node-red/settings.js
Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Context store : 'default' [module=memory]
Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] User directory : /home/pi/.node-red
Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [warn] Projects disabled : editorTheme.projects.enabled=false
Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Flows file : /home/pi/.node-red/flows.json
Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Creating new flow file
Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [warn] Encrypted credentials not found
Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Starting flows
Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Started flows
Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Server now running at http://127.0.0.1:1880/
I only have one Raspberry Pi 3 available so cannot swap out the hardware but I tried sudo memtester 500 1 which didn't show any failures. It is worth noting though that the issue does not occur when installing the same clean build on a Pi 4!
Hi zenofmud and thank you for your reply. Regarding your questions...
Raspberry Pi OS Lite (32bit) - bullseye
The installation described above had nothing installed apart from Node-RED (with no additional nodes and no flows). The installation sequence above lists the only commands executed after the Pi powered up with a new image. The ~4 minute high processor usage was observed by executing top as soon as I logged on after reboot.
No - Lite. It is headless. All installation / configuration is from a command line.
To check, I've just disabled Node-RED Autostart on Boot, re booted and run node-red-start. Seems to take approximately 7 seconds to start up...
Starting as a systemd service.
11 Oct 15:53:59 - [info]
Welcome to Node-RED
11 Oct 15:53:59 - [info] Node-RED version: v3.1.0
11 Oct 15:53:59 - [info] Node.js version: v18.18.0
11 Oct 15:53:59 - [info] Linux 6.1.21-v7+ arm LE
11 Oct 15:54:02 - [info] Loading palette nodes
11 Oct 15:54:05 - [info] Dashboard version 3.6.0 started at /ui
11 Oct 15:54:06 - [info] Settings file : /home/pi/.node-red/settings.js
11 Oct 15:54:06 - [info] Context store : 'default' [module=memory]
11 Oct 15:54:06 - [info] User directory : /home/pi/.node-red
11 Oct 15:54:06 - [warn] Projects disabled : editorTheme.projects.enabled=false
11 Oct 15:54:06 - [info] Flows file : /home/pi/.node-red/flows.json
11 Oct 15:54:06 - [warn] Encrypted credentials not found
11 Oct 15:54:06 - [info] Server now running at http://127.0.0.1:1880/
11 Oct 15:54:06 - [info] Starting flows
11 Oct 15:54:06 - [info] Started flows
Apart from the CPU anomaly at start up, the system seems to be running fine. I have subsequently proceeded to install Plex Media Server, Samba, three Node-RED nodes and a flow. All seems ok!
I have attached two screenshots from top. One immediately after start up (~200% CPU) the other ~4 minutes later. Now that Node-RED is doing "something" top shows CPU varying between 1.3% and 7.6%.
Node RED has been installed on much much lower spec pieces of hardware!
unless you do something in your flows like an insane endless data loop - I really wouldn't worry.
Noted and thank you. I guess I don't like anomalies! I have other (older) systems and have checked them - CPU usage "normal" at start up; Raspberry Pi 4 - CPU usage "normal" at start up. Either something is different with or has changed within the OS or Node-RED re. Raspberry Pi 3 or I am doing something wrong. Just like to know.
If this is with a blank flow - I guess its "normal" , if you actually have flows, then you can export said flow, and we may be able to spot something - especially if you have inject nodes that fire at start up.
This screenshot is how I noticed the CPU usage issue! Do note however, the issue manifested itself on an installation with NO additional nodes and no flows using top / htop to display CPU%
Don't seem to have the right menu item???
In any case, the issue manifested itself on an installation with NO additional nodes and no flows. I can't see how my flow would have caused the problem.
Ok so either I am going mad or someone is playing tricks behind the (Raspberry Pi OS) scene!
I slept on the problem overnight and came up with a few things to try. Interestingly, four rebuilds later (with SD, HDD and a few build sequence changes) Node-RED installed perfectly every time! There was no excessive CPU usage on any of the builds.
HOWEVER in each build syslog was missing. Searching showed the file did not exist. Indeed /var/log/ contained very few files at all compared with similar builds. e.g. no kern.log, messages, auth.log, etc. I do not know what all of these file are for but seems to me that they ought to be there.
What I have discovered is that the image downloaded via Raspberry Pi Imager has changed from bullseye to bookworm between 9/10/23 (High CPU Usage) and today (Normal CPU Usage). Hmm.
There are differences in the nodered-install.log's generated between those dates showing this change of OS including the appearance of the line...
Apparently rsyslog is not enabled in bookworm (google will bring up numerous references if you need it). So the log files are not generated. The 'solution' is to learn how to use journalctl for displaying logs. journalctl has been available for a long time. node-red-log, for example, uses it for displaying the node red log. Alternatively I expect it is possible to install and enable rsyslog.