Flowfuse Device Agent crashes. FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

Hi @HermanWiid, welcome to the forum.

First let me state, this is not a FlowFuse issue. By labeliing it up as FlowFuse and positioning it in this category you get less responses from users not familiar with FlowFuse.

So, you error is related to heap memory usage in a Node application - in this case, Node-RED.

Unfortunately these are particularly tricky to trackdown but there are numerous threads on this forum that you could extract information to help you.

The error get thrown in a variety of situations, here are a few:

  • When attempting to process large amounts of data or execute complex algorithms that require a lot of memory.
  • When running a Node.js server with a large number of connections or concurrent requests.
  • When running a Node.js application in a container or virtual machine with limited memory resources.

Could you list out details like the VM size, available memory. If you have access to the VM, perhaps you could use top or htop to check its resources? Also, what contrib nodes you are using?


Closing thoughts...

It is most likely, since this occurred after a modification that there is an issue in your flows. This can happen if you cause backpressure (i.e. lots of messages building up in a loop or delay - aka "in flight". I would consider rolling back to a snapshot where you did not have this problem. Additionally, Node-RED v3.0.8 is not current. I would likely update to v4.0.9.