Memory leakage with simple dashboard

I found this problem frequently in the web in combination with raspberry pi, but no general solution.

I'm running node-red in a docker container on ubuntu. I installed this two weeks ago, so all versions should be up to date. Im running quite "heavy" workflows with hundreds of variables and messages per seconds without any problem for many days.

Now I added a dashboard which I meanwhile placed in a separate docker container. Displaying the dashboard leads to growing memory, that finally stops the browser. This is with Firefox, Chrome and Opera, so in my opinion now sepcific browser problem. If I embed the dashboard in another website, that is refreshed every 15 minutes, the memory is always reset to lower values. If I show the dashboard in node-red the memory is full after a few hours. So, what can I do?

Here is the flow:

[{"id":"8bb0aedc.da276","type":"tab","label":"free dashboard","disabled":false,"info":""},{"id":"87cc5db8.27fb6","type":"inject","z":"8bb0aedc.da276","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":0.1,"x":150,"y":80,"wires":[["f81913fe.8d17c"]]},{"id":"f81913fe.8d17c","type":"function","z":"8bb0aedc.da276","name":"random","func":"\nmsg.payload = Math.random();\nmsg.topic = 'var01';\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":80,"wires":[["3b98bf44.6a518"]]},{"id":"f87b0f0f.64821","type":"ui_gauge","z":"8bb0aedc.da276","name":"var 1","group":"dc8c45d7.71a5f8","order":1,"width":3,"height":3,"gtype":"gage","title":"Druck","label":"bar","format":"{{value | number:1}}","min":0,"max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":850,"y":80,"wires":[]},{"id":"2a9c2456.d1d52c","type":"ui_gauge","z":"8bb0aedc.da276","name":"var 2","group":"dc8c45d7.71a5f8","order":2,"width":3,"height":3,"gtype":"donut","title":"Spannung","label":"kV","format":"{{values | number:1}}","min":0,"max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":850,"y":160,"wires":[]},{"id":"ee478879.534d28","type":"inject","z":"8bb0aedc.da276","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"0.2","x":150,"y":160,"wires":[["b5fdd73f.ce9c68"]]},{"id":"ebe17cb4.199cb","type":"ui_gauge","z":"8bb0aedc.da276","name":"var 3","group":"dc8c45d7.71a5f8","order":3,"width":3,"height":3,"gtype":"compass","title":"Richtung","label":"Deg","format":"{{values | number:1}}","min":0,"max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":850,"y":240,"wires":[]},{"id":"c9801efb.c0d6a","type":"inject","z":"8bb0aedc.da276","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"0.3","x":150,"y":240,"wires":[["99c13c63.ef197"]]},{"id":"7870a29c.8f310c","type":"ui_gauge","z":"8bb0aedc.da276","name":"var 4","group":"dc8c45d7.71a5f8","order":4,"width":3,"height":3,"gtype":"wave","title":"FĂĽllstand","label":"mm","format":"{{values | number:1}}","min":0,"max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":850,"y":320,"wires":[]},{"id":"dae968ba.fb1318","type":"inject","z":"8bb0aedc.da276","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"0.4","x":150,"y":320,"wires":[["b3feb344.89023"]]},{"id":"d24700ae.6503a","type":"ui_gauge","z":"8bb0aedc.da276","name":"var 5","group":"dc8c45d7.71a5f8","order":5,"width":3,"height":3,"gtype":"donut","title":"Temperatur","label":"K","format":"{{values | number:1}}","min":0,"max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":850,"y":400,"wires":[]},{"id":"806d3e1b.bf81c","type":"inject","z":"8bb0aedc.da276","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"0.5","x":150,"y":400,"wires":[["1bfbb658.636c4a"]]},{"id":"4392adb4.3aa5a4","type":"ui_gauge","z":"8bb0aedc.da276","name":"var 6","group":"dc8c45d7.71a5f8","order":7,"width":3,"height":3,"gtype":"gage","title":"Kraft","label":"kN","format":"{{values | number:1}}","min":0,"max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":850,"y":480,"wires":[]},{"id":"be00e9cf.e75338","type":"inject","z":"8bb0aedc.da276","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"0.6","x":150,"y":480,"wires":[["36d7722c.c5398e"]]},{"id":"3b98bf44.6a518","type":"switch","z":"8bb0aedc.da276","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"var01","vt":"str"},{"t":"eq","v":"var02","vt":"str"},{"t":"eq","v":"var03","vt":"str"},{"t":"eq","v":"var04","vt":"str"},{"t":"eq","v":"var05","vt":"str"},{"t":"eq","v":"var06","vt":"str"},{"t":"eq","v":"var07","vt":"str"},{"t":"eq","v":"var08","vt":"str"},{"t":"eq","v":"var09","vt":"str"},{"t":"eq","v":"var10","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":610,"y":280,"wires":[["f87b0f0f.64821"],["2a9c2456.d1d52c"],["ebe17cb4.199cb"],["7870a29c.8f310c"],["d24700ae.6503a"],["4392adb4.3aa5a4"],["ea045e51.e5334"],["36ff91ed.26746e","5a222e32.63f47"],["10a73de4.828072"],["704e6f6d.da7de"]]},{"id":"1bfbb658.636c4a","type":"function","z":"8bb0aedc.da276","name":"random","func":"\nmsg.payload = Math.random();\nmsg.topic = 'var05';\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":400,"wires":[["3b98bf44.6a518"]]},{"id":"b3feb344.89023","type":"function","z":"8bb0aedc.da276","name":"random","func":"\nmsg.payload = Math.random();\nmsg.topic = 'var04';\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":320,"wires":[["3b98bf44.6a518"]]},{"id":"99c13c63.ef197","type":"function","z":"8bb0aedc.da276","name":"random","func":"\nmsg.payload = Math.random();\nmsg.topic = 'var03';\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":240,"wires":[["3b98bf44.6a518"]]},{"id":"b5fdd73f.ce9c68","type":"function","z":"8bb0aedc.da276","name":"random","func":"\nmsg.payload = Math.random();\nmsg.topic = 'var02';\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":160,"wires":[["3b98bf44.6a518"]]},{"id":"36d7722c.c5398e","type":"function","z":"8bb0aedc.da276","name":"random","func":"\nmsg.payload = Math.random();\nmsg.topic = 'var06';\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":480,"wires":[["3b98bf44.6a518"]]},{"id":"ea045e51.e5334","type":"ui_chart","z":"8bb0aedc.da276","name":"var07","group":"dc8c45d7.71a5f8","order":6,"width":9,"height":3,"label":"Durchfluss in l/min","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"bezier","nodata":"","dot":false,"ymin":"0","ymax":"2","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":850,"y":560,"wires":[[]]},{"id":"1abe948f.340ccb","type":"inject","z":"8bb0aedc.da276","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"0.7","x":150,"y":560,"wires":[["46aabf6c.d9711"]]},{"id":"46aabf6c.d9711","type":"function","z":"8bb0aedc.da276","name":"random","func":"\nmsg.payload = Math.random();\nmsg.topic = 'var07';\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":560,"wires":[["3b98bf44.6a518"]]},{"id":"36ff91ed.26746e","type":"ui_level","z":"8bb0aedc.da276","group":"dc8c45d7.71a5f8","order":8,"width":9,"height":1,"name":"var08","label":"Schlupf 1","colorHi":"#e60000","colorWarn":"#ff9900","colorNormal":"#00b33c","colorOff":"#595959","min":0,"max":"100","segWarn":"50","segHigh":"75","unit":"","layout":"sh","channelA":"","channelB":"","decimals":0,"animations":"soft","shape":"3","colorschema":"fixed","textoptions":"default","colorText":"#eeeeee","fontLabel":"","fontValue":"","fontSmall":"","colorFromTheme":true,"textAnimations":true,"hideValue":true,"tickmode":"segments","peakmode":true,"peaktime":3000,"x":850,"y":640,"wires":[]},{"id":"d099e971.b55218","type":"inject","z":"8bb0aedc.da276","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"0.8","x":150,"y":640,"wires":[["e026dc0c.a1884"]]},{"id":"e026dc0c.a1884","type":"function","z":"8bb0aedc.da276","name":"random","func":"\nmsg.payload = Math.random()*100;\nmsg.topic = 'var08';\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":640,"wires":[["3b98bf44.6a518"]]},{"id":"5a222e32.63f47","type":"ui_level","z":"8bb0aedc.da276","group":"dc8c45d7.71a5f8","order":9,"width":9,"height":1,"name":"var08","label":"Schlupf 2","colorHi":"#e60000","colorWarn":"#ffff00","colorNormal":"#00b33c","colorOff":"#595959","min":0,"max":"100","segWarn":"20","segHigh":"70","unit":"","layout":"sh","channelA":"","channelB":"","decimals":0,"animations":"rocket","shape":"3","colorschema":"rainbow","textoptions":"default","colorText":"#eeeeee","fontLabel":"","fontValue":"","fontSmall":"","colorFromTheme":true,"textAnimations":false,"hideValue":true,"tickmode":"segments","peakmode":false,"peaktime":3000,"x":850,"y":680,"wires":[]},{"id":"10a73de4.828072","type":"ui_led","z":"8bb0aedc.da276","group":"dc8c45d7.71a5f8","order":10,"width":2,"height":1,"label":"Status","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"red","valueType":"str"},{"color":"green","value":"green","valueType":"str"},{"color":"yellow","value":"yellow","valueType":"str"},{"color":"blue","value":"blue","valueType":"str"},{"color":"white","value":"white","valueType":"str"}],"allowColorForValueInMessage":false,"name":"var09","x":850,"y":740,"wires":[]},{"id":"9475e608.906688","type":"inject","z":"8bb0aedc.da276","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"0.9","x":150,"y":720,"wires":[["b70e1341.6120e"]]},{"id":"b70e1341.6120e","type":"function","z":"8bb0aedc.da276","name":"random","func":"var cols = ['red','green','yellow','blue','white'];\nvar idx = Math.floor(Math.random()*cols.length);\nmsg.payload = cols[idx];\nmsg.topic = 'var09';\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":720,"wires":[["3b98bf44.6a518"]]},{"id":"704e6f6d.da7de","type":"ui_table","z":"8bb0aedc.da276","group":"dc8c45d7.71a5f8","name":"Tabelle 10","order":11,"width":7,"height":"2","columns":[{"field":"Wert A","title":"Plan W","width":"","align":"center","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"Wert B","title":"Plan K","width":"","align":"center","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"Wert C","title":"QS","width":"","align":"center","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":870,"y":800,"wires":[]},{"id":"e86ac50a.4a58e8","type":"inject","z":"8bb0aedc.da276","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"0.95","x":150,"y":800,"wires":[["f493aad9.7a0578"]]},{"id":"f493aad9.7a0578","type":"function","z":"8bb0aedc.da276","name":"random","func":"var cols = ['aa','bb','cc','dd','ee'];\nvar idx;\n\nvar obj = {};\n\nidx = Math.floor(Math.random()*cols.length);\nobj['Wert A'] = cols[idx];\n\nidx = Math.floor(Math.random()*cols.length);\nobj['Wert B'] = cols[idx];\n\nidx = Math.floor(Math.random()*cols.length);\nobj['Wert C'] = cols[idx];\n\n/*\nmsg.payload = {'command':'replaceData', \n 'arguments':[obj,true],\n 'returnPromise': true};*/\n\nmsg.payload = [obj];\n\nmsg.topic = 'var10';\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":800,"wires":[["3b98bf44.6a518"]]},{"id":"dc8c45d7.71a5f8","type":"ui_group","z":"","name":"Horizontal","tab":"8097d5af.d59238","order":3,"disp":false,"width":12,"collapse":false},{"id":"8097d5af.d59238","type":"ui_tab","z":"","name":"Process Data","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

If in doubt always suspect the chart :slight_smile:

1 Like

Did some overall heap profiling and the table node seems to be most expensive element (I removed the ui_led cos I didn't want to install it to this machine)
Feeding new data every second to table node sounds for me a little bit not very optimized way to have tables on dashboard. Is it?
So what if without table node?

1 Like

I plan to visualize some process data, that are updated at least once a second. So a table seems to be a good structuring element for displaying the data. The same is for the chart, since in pocess visualization charts are quite important.

My question is possibly, if I utilize the dashboard nodes in a wrong way or if there are some kown bugs in the dashboard nodes?

For table node it is not a bug but design decision. It is not targeted to rapid changes.
Mostly tables have pretty steady content cos who can read many fast changing numbers (or what ever in it) and make some resolution on that info. It is not task for human.

Hmmm ... you migth be right, but if the table is the reason and if I update the table e.g.once a minute, the leakage will finally kill the browser 60 times later than now.

I have running a dashboard on it's own for a few days now, so I think the dashboard is not the origin of the problem. I also read in the web, that the gauge nodes are critical. So maybe I have to remove nodes and check the dashboard step by step :frowning:

By the way:
If you have ever been in a control room of a large machine (with usualle a few thousands of sensors), you would understand, that it is common to display also fast changing data for human :slight_smile:

I still run your setup without table node and I can't see any growing. Runs pretty steady last 40+ minutes.

After hour of running still steady. I think you can go on with gauges safely. (Happy to have ui_level included :slight_smile: )

This is most probably because of bad planning, luck of resources and time and painful legacy to support and no way to have long enough down time to change something. Yes I have seen such.

Which version of node-red you are running? And on which os?

I use ubuntu 18.x with docker and the node-red inside docker is 1.0.4. In meanwhile I have again more than 1 GB starting from below 300 kB.

Edit:
I now removed the ui_led, since this is the main difference ?!?

If it does then that would indicate a bug.

15 Apr 08:09:53 - [info] Node-RED version: v1.0.5
15 Apr 08:09:53 - [info] Node.js  version: v12.13.0
15 Apr 08:09:53 - [info] Windows_NT 10.0.18362 x64 LE
15 Apr 08:10:07 - [info] Loading palette nodes
15 Apr 08:11:01 - [info] Worldmap version 2.1.2
15 Apr 08:11:03 - [info] Dashboard version 2.19.4

PC Intel core i5 2.3GHz RAM 4GB

You should check it cos I didn't.

I took a time to make some experiments to understand the source performance drop of dashboard.
One word. Chart.
But not that famous "too much data to render" issue. Well that also exist. But can be avoided.
What can't be avoided is issue witch reveals itself when dashboard page is inactive for some time and then brought back in focus. With tab active, the memory usage is pretty steady.

Well i did all wrong with plotting the measurements with the tool under the investigation so don't take it as absolute thing but just reference.

image

Graph starts at the moment of bringing the browser tab active.
It grows fast and then major garbage collection kicks in and frees the memory.
But even the memory is released, the animations of other elements on page still are jerky. And that is permanent. It does not change any more. Refresh the tab brings back the smooth animations.

So something is going on under the hood.

Chartjs is about to launch version 3.0 sometime in near future (currently alpha)
This promises performance improvements but breaking changes also so ...

and of course we are using https://jtblin.github.io/angular-chart.js/ - which is well behind the curve...

Yep. And I can't see any easy changes on that route...

Meanwhile I had to restart my docker container and now it seems that all is stable ?!?!?!

Maybe somewhere in the background a misconfigured node was still active in the node-red environment, even if the flow changed - if this is possible. The only "constant" value in the game was the container, since I changed certain settings in the flow and tested it from different computers and operating systems and browsers.

It is slightly like the IT help desk question "Did you reboot your computer?", but replace computer with docker container :frowning:

I will keep an eye on this.

1 Like

Based on fact that i did many deep clean up procedures during my tests, I can say, the described issue with chart is not avoidable. It is possible that partial updates when you are creating and constantly changing the dashboard may have some potential to lead to leakages but those will be very hard to discover.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.