Chromium eats up all the RAM

Hi, I've got a fairly simple dashboard that I'm trying to keep running on a Pi in a kiosk. Its got 2 gauges and a chart. The gauges update every second. The chart has a limiter of 2hrs of data and the data source is 2 plots with a rate limit of 1/every 30 seconds. Everything seems to run fine, for a while. Then chrome chews up all the RAM and the tab crashes. Page reload seems to fix it, but I feel like this shouldn't be happening. There is a "System info" tab (thats not normally displayed) with 4 gauges and some text fields that show system information.

Any suggestions?

We have the same problem here and because of it we don't use Gauges any more.
I opened an issue for that (https://github.com/node-red/node-red-dashboard/issues/183). The issue was closed but recently I tried again with the newest versions and it still persist.

@dceejay is there anything we can do to help you on finding where the problem is?

Certainly charts seem to "leak" more than anything... though as per the closed issue I've not personally had problems with gauges unless I have 20 or 30 of them updating 1 per sec. At home I run a Pi with two charts and 2 gauges (set for 6 hours history) updating every 10 secs for months at a time - but always browse in from laptop, so it's the laptop memory that would grow.

Not sure how to debug... needs an expert in javascript web page profiling to get involved :slight_smile:

@dceejay in our case the browser (Electron or Chromium) is running 24/7 right on the PI and the memory leak seems to occur on the browser (not in the Node-RED node)

yes - it will be in the browser. You can turn on dev tools in electron and monitor the memory usage.
Not sure how to tell the browser to restrict it's memory usage. I would start by editing/removing the chart.

I can not solve it for you - but what about a timed (cron) script that kills the chromium process every (say 2 hours) and then reloads it - total outage time would probably only be 10 seconds or so - which assuming this is not interctive (should not) be a problem

Craig

or maybe look at restricting chrome a bit on small devices...eg https://gist.github.com/juanje/9861623
but...uurgh

You could use an exec node to run cat /proc/meminfo, then parse the output to determine the available memory and itf it's below a certain threshold do a pkill chromium then relaunch.

Totally a bandaid and janky as all hell, but it might do the trick for a bit.

Have you put a debug node on the input to the chart to make sure it is only getting new data every 30 seconds, in case there is an error in your flow so the data is more rapid than you think?