Warning OPC UA Client OPCUA_Hydraulic_Shop | Reconnecting server due to connection loss.
Hi @TA_12423679 ,
From the OPC UA client machine, run a continuous ping to the Kepware server IP for 10 to 15 minutes.
At the same time, trigger the issue and note the exact timestamp when the “Reconnecting server due to connection loss” appears.
If ping shows packet loss or latency spikes at the same timestamp, this is network path instability. Move to Step 2.
If ping is clean, move to Step 3.
Check if traffic crosses any firewall, router, VPN, or NAT device between client and Kepware.
On that device, look for TCP idle session timeout rules. OPC UA is long lived TCP. Many environments drop “idle” sessions even though they are valid.
Fix: create a rule exception for Kepware OPC UA port (default 49320 unless changed) to allow long lived sessions, or increase TCP idle timeout to at least 30 to 60 minutes.
Retest. If reconnects stop, root cause is infrastructure timeouts.
On the OPC UA client configuration:
Increase Session Timeout to 30 minutes or higher.
Increase Subscription Lifetime to at least 10x the Publishing Interval.
Set KeepAlive Count to a reasonable value (example: 10).
Set Publishing Interval to something stable (example: 1000 ms) and avoid very low values unless needed.
On Kepware OPC UA Server configuration:
Open OPC UA Configuration in Kepware.
Increase Session Timeout limit if the client is requesting a higher value.
Verify Max Subscriptions and Max Sessions are not being hit.
Apply changes and retest.
Expected outcome: If reconnect frequency drops or stops, this was a UA timeout mismatch.
On Kepware, open the OPC UA Configuration and check Trusted Clients.
Confirm the client certificate is trusted and not in Rejected.
Confirm the certificate is not expired and the system time on both machines is correct.
If the client certificate changed recently, re trust it and retest.
On the Kepware server, check CPU and memory when the reconnect happens.
Look at Kepware logs around that timestamp for resource warnings or UA server messages.
If CPU is pegged, reduce UA load: fewer monitored items per subscription, fewer subscriptions, increase publishing interval.
Test with a second OPC UA client (UAExpert or Kepware OPC Quick Client for UA).
If the second client stays stable while the original client reconnects, root cause is the original client’s UA stack or settings.
Thanks,
