Hey there. As you might have noticed, I am doing some flow stuff with files on networks. Due to this, I created a pretty complex flow, analysing and parsing files and after that sending them to a MQTT broker.
NodeRED: 2.2.0
NodeJS: 16.3
OS: Windows
after some tests I found out, that somehow it suffers from a memory leak.
I did a HeapDump via v8 and if I look at the dump, i often see stuff like this:
this error comes every time... after restart ... a few hours later the HEAP grows. I included a v8 routine to get the state of heap and pass it to a ELK ... here is the graph.
right you see max(blue), red(used) and green(free) changing until (autimatic) restart after crash. Middle you see the asumpted size of my internal (flow) array containing some information (which file was read). Left you see some "limit" nodes how many files are in queue. Due to the timescale it looks "stable".
List by inject always show aprox 80k for inject file list and 50k for the other dir. Both are piled up to 140k and processed until 0.
Even smaller range...
in this small ragen you also see, that there is no more activity (no update on the left side, since the status update node does not see a value changing in any limit node).
And furthermore you see, that even while there are no files processed, memory consumption increases a bit ...
While there is NO file in the flow, I show some stats (with time of events like in this screenshot):
Below the nodes you see the times... and those values show up in the heap dump
Since the flow chechs every 20s if there are new files to process ... it shows the last time it checked.
And while files are processed, it updates the time shown for every file.
Also I use status node for showing the last message time when a certain path was activated by a incomming msg.