OPCFoundation / UA-.NETStandard

OPC Unified Architecture .NET Standard
Other
1.97k stars 950 forks source link

opc ua server unresponsive as the number of monitored items in the server increase. #2840

Open vinaybr opened 1 week ago

vinaybr commented 1 week ago

Type of issue

Current Behavior

We have built an OPC UA Server which receives data from an external system. The external system raises events with data values at regular intervals. when the data is received the following code is executed foreach parameter -

node.Value = readResult.Value?.Value; node.StatusCode = (uint)readResult.StatusCode; node.Timestamp = time; node.ClearChangeMasks(SystemContext, false);

As the number of parameters being monitored increases (around 7000) the server becomes unresponsive. This is observed consistently on a specific machine and not so frequently on others. Prelimnary investigation of the dump file shows many threads stuck with the below callstack -

System.Threading.Monitor.ReliableEnter(System.Object, Boolean ByRef) Opc.Ua.Server.MonitoredNode2.OnMonitoredNodeChanged(Opc.Ua.ISystemContext, Opc.Ua.NodeState, Opc.Ua.NodeStateChangeMasks) Opc.Ua.NodeState.ClearChangeMasks(Opc.Ua.ISystemContext, Boolean)

Expected Behavior

No response

Steps To Reproduce

No response

Environment

- OS: Win 10
- Environment: 
- Runtime: .Net6
- Nuget Version: 1.5.372.113
- Component: OPC.Ua.Server
- Server: 
- Client: UA Expert

Anything else?

No response