I am trying to run node-red continuously to connect with the OpcUa server automatically when the injection machine turns on but I got the error below..
node-red version v3.1.9 and node.js version v18.20.2
22 May 18:44:30 - [error] [OpcUa-Client:b95eecf0ea19f418] Client node error on: error: [" error at active reading: Connection Break"]
22 May 18:44:31 - [error] [OpcUa-Client:b95eecf0ea19f418] Client node error on: error: [" error at active reading: Invalid Channel BadConnectionClosed"]
<--- Last few GCs --->
[14796:000002A718B7FA30] 29651103 ms: Scavenge 4031.9 (4125.5) -> 4020.5 (4126.0) MB, 6.18 / 0.00 ms (average mu = 0.800, current mu = 0.171) task;
[14796:000002A718B7FA30] 29653567 ms: Scavenge 4033.0 (4126.0) -> 4021.2 (4126.7) MB, 6.24 / 0.00 ms (average mu = 0.800, current mu = 0.171) task;
[14796:000002A718B7FA30] 29662571 ms: Mark-Compact 4146.5 (4240.1) -> 4057.7 (4163.8) MB, 6578.87 / 0.00 ms (average mu = 0.719, current mu = 0.617) task; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----
And what frequency is the inject node running? Every 100ms? Every 1s?
I have a theory you are causing this issue.
Consider this, the inject runs every 100ms, and calls 15 network type nodes. All 15 nodes attempt to do a network request to the OPCUA server. They get eventually timeout, but all the while you keep inputting msgs into them, 15 more, 15 more, 15 more until
It is just a theory but there may be something in it.
You might want to see if there is some way of determining the connection status (usually a status node pointed at the OPC UA Client node can work) - then add a switch after the inject to inhibit messages if the connection is offline & avoid filling the memory with queued requests.