I’ve run out of Memory access in HA Node-red intergration.
Was previously using HA in a windows virtual box, had the same issue but fixed it by typing in the termanal:➜ /config git:(master) ✗ set NODE_OPTIONS=--max-old-space-size=8192
Today I have moved from the testing VM onto a laptop for headless permant install using x86_64 HA build. (Details Below)
|Version|core-2022.2.5|
|Installation Type|Home Assistant OS|
|Development|false|
|Supervisor|true|
|Docker|true|
|User|root|
|Virtual Environment|false|
|Python Version|3.9.7|
|Operating System Family|Linux|
|Operating System Version|5.10.91|
|CPU Architecture|x86_64|
8GB RAM.
128GB SSD
Everything went ok, Installed NR from the HA Add-on store. Checked logs then imported existing Flow.
But the Node-Red Fatal error returned, so I tried this in the Studio Code Server Termanal again like last time in the VM: set NODE_OPTIONS=--max-old-space-size=5000 as I only have 8GB in the laptop.
Restarted core, supervisor & host thou nothing I do seems to allow it to allocate just a bit more space past the Node-Red default old_space_size of just less than 2GB, I require 2.3GB no more.
New install, everything is default, thou I have added in NR settings.js:
Anyone know how to expand the limit or fix this issue using HA node-red?
I am wanting to “expand the default limit”, not start a new flows.json or alike.
Thanks in advanced
LOG___________________________________
[569:0x7f7215447330] 48701 ms: Scavenge (reduce) 1931.4 (2083.1) -> 1930.8 (2083.3) MB, 10.2 / 0.0 ms (average mu = 0.101, current mu = 0.030) allocation failure
[569:0x7f7215447330] 51799 ms: Mark-sweep (reduce) 1932.2 (2083.8) -> 1921.4 (2083.8) MB, 3070.6 / 0.3 ms (average mu = 0.198, current mu = 0.290) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory```
___________________________________
I have made some progress here, using linux (HA) the command I referanced above ‘set’ is for windows node-red… so this is what I have so far to fix/reproduce.
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
HA in the HA add-on ‘Studio Code Server’ (or whatever your flavor)
Open up a - Termanal
(Top Righthand icon 3 horizontal lines (scroll to Terminal/New Terminal.
(LINUX or HA) ‘export’
TYPE: ‘node-red’ (Press Enter - should switch line to node-red)
TYPE: ‘export’ (Press Enter - should spam (look for ‘NODE_OPTIONS=’–max-old-space-size=2048 ‘’)
TYPE: export NODE_OPTIONS=–max-old-space-size=8192 (Press Enter - 8192 is MB(or 8GB)to allocate - assign more or less per your requirements)
TYPE: export (Press Enter, should spam (look for ‘NODE_OPTIONS=’–max-old-space-size=8192 ‘’)
Looks as if you are setting the environment variable via Code Server, which is running in a separate container.
It’s likely you could do this either using the Init Commands option, or by specifying the Environment Variable, both of which are in the documentation.
For configuration help I would suggest using Discord or the forums.
On the addon the re is a config tab, in that section under init_commands you can run a command during startup. env_variables are defined in settings.js in the nodered folder.
Even though it’s in a windows vm, the operating environment I believe is still linux.
try it with export, I mean try set as well but I do think it’s linux.
What is the os environment it is running in now? If it’s docker or something similar you may need to increase the memory allocated to the container as well as nodered.
During the HA install I just flashed HA using etcher onto the SSD and HA started,
IDK but I think HA runs in in a docker as when I go to HA UI Configuration/Settings/Info it does say “Docker=true”.
Would you know how I do incress this?
If you are reading this in the future, please keep in mind this is not a solution should you have a memory leak, this is not a long-term fix for that… and this option should only be used be for when you understand that it is not a leak. and require some more system oomph.
By increasing it assisted me to mot only get Node-Red to load again but increased the “Deploy” (reload) time back to where it was originally on an empty flow, as Re-Deploy had been slowing down prior for months prior to the crash.