mariussandu - 10 hours ago

Hello,

I am experiencing an intermittent OPC UA server issue on CODESYS Control for Raspberry Pi SL 4.21.0.0.
Runtime information:

codesyscontrol 4.21.0.0
Raspberry Pi 4 Model B Rev 1.1 - 4Gb
OPC UA Server: CmpOPCUAServer 3.5.22.x
Server IP: 192.168.0.110
OPC UA endpoint: opc.tcp://192.168.0.110:4840

The main OPC UA client is Node-RED running on 192.168.0.111. This has an active subscription with some tags and also some write functions active.
The system normally works correctly for a period, but at some time the OPC UA communication stopped.
Node-RED started reconnecting continuously but could not reconnect.
I also tried connecting using UaExpert, but UaExpert returned: BadTimeout

At the same time, the PLC application itself was still running.
Before restarting CODESYS, I captured the TCP connections.
The OPC UA server was still listening:
tcp 11 0 192.168.0.110:4840 0.0.0.0:* LISTEN

However, there were many connections from the Node-RED client stuck in CLOSE_WAIT:
192.168.0.110:4840 192.168.0.111:45008 CLOSE_WAIT
192.168.0.110:4840 192.168.0.111:53678 CLOSE_WAIT
192.168.0.110:4840 192.168.0.111:44032 CLOSE_WAIT
192.168.0.110:4840 192.168.0.111:36612 CLOSE_WAIT
192.168.0.110:4840 192.168.0.111:45012 CLOSE_WAIT
192.168.0.110:4840 192.168.0.111:36592 CLOSE_WAIT
...

Some of these sockets also had data remaining in Recv-Q, for example:
Recv-Q = 61
Recv-Q = 121
There were roughly 15–20 OPC UA connections in CLOSE_WAIT.
Restarting only the CODESYS runtime immediately restored OPC UA communication.
After restart:
LISTEN 0 10 192.168.0.110:4840
and both Node-RED and UaExpert can connect normally again. There are no obvious OPC UA errors during startup or in log.

On RPI 2 I had a memory leak regarding OPCUA so I had to upgrade to RPI4.
What can I do in this case?
Thank you!