Non-changing values causing QOpcUa connection drop
-
Here my code to enable the monitoring of an OpcUa variable:
QOpcUaNode *node = // retrieve the desired node QOpcUaMonitoringParameters params(1000); params.setMaxKeepAliveCount(10); params.setLifetimeCount(30); QOpcUaNode *node = // retrieve the desired node node->enableMonitoring(QOpcUa::NodeAttribute::Value, params);
If the variables monitored change their values constantly the application runs fine the whole day. But when at least one variable does not change its value for a while (few minutes!) the connection drops with the following messages:
"Received a ServiceFault response"
"The ServiceResult has the StatusCode BadTimeout"
"Received Timeout for Publish Response"
"The ServiceResult has the StatusCode BadNoSubscription"Reading the OpcUa documentation it seems that if the value is steady the server should push a notification anyway after a timeout (given by the above parameters).
In the factory we have different kind of machines and some of them have no problems (even with variable that does not change the value for days) while others drop the connection every few minutes - no matter the settings.At first glance one could say: "well, it's a server fault then". I've tried with the official QOpcUa Viewer example and the behavior is exactly the same of my application... but using a different OpcUa client (I guess Qt-based as well, like Matrikon OPC UA Explorer ) the connection won't drop at all.
I tried to manually poll a variable every few seconds, but of course it does not affect the monitoring - hence the server closes the connection anyway.
Is there anything I could do to keep the connection alive?
I'm using Qt 6.4.0 under Ubuntu 22.04.