[BUG] OPCUA long back-off time when connection is lost
Describe the bug The OPCUA connector waits a very long time before attempting the next connection attempt. This happens already after the first disconnect, which might be due to intermittent wifi/ethernet issues... In an IoT setting I would expect either a exponential back-off with a max of 1 minute or simply trying every 5 seconds (given that the number of devices is limited anyhow).
Connector name (If bug in the some connector): OPC-UA Connector
Error traceback (If available):
2025-06-18 08:26:54 - |INFO| - [opcua_connector.py] - opcua_connector - _load_devices_nodes - 725 - Loading nodes for device: Inspection_Table, section: timeseries, nodes count: 85
2025-06-18 08:26:59 - |WARNING| - [opcua_connector.py] - opcua_connector - start_client - 370 - Connection lost for OPC-UA Connector 1, will try to reconnect...
2025-06-18 08:27:00 - |INFO| - [opcua_connector.py] - opcua_connector - retry_connect_with_backoff - 410 - Last contact was 7.02 seconds ago, next connection try in 112.98 seconds...
2025-06-18 08:27:04 - |WARNING| - [opcua_connector.py] - opcua_connector - start_client - 370 - Connection lost for OPC-UA Connector 2, will try to reconnect...
2025-06-18 08:27:04 - |WARNING| - [opcua_connector.py] - opcua_connector - start_client - 370 - Connection lost for OPC-UA Connector 3, will try to reconnect...
2025-06-18 08:27:05 - |INFO| - [opcua_connector.py] - opcua_connector - retry_connect_with_backoff - 410 - Last contact was 10.72 seconds ago, next connection try in 109.28 seconds...
2025-06-18 08:27:05 - |INFO| - [opcua_connector.py] - opcua_connector - retry_connect_with_backoff - 410 - Last contact was 9.95 seconds ago, next connection try in 110.05 seconds...
Versions (please complete the following information):
- OS: Ubuntu
- Thingsboard IoT Gateway version: Docker 3.7.4
Hi @wilterdinkrobert,
Thank you for your interest in ThingsBoard IoT Gateway,
We have added a new parameters to OPC-UA connector (reconnectRetriesCount default 8, reconnectBackoffInitialDelay default 1, reconnectBackoffFactor default 2), these parameters allow to control reconnect behavior.
You will need to change reconnectRetriesCount it changes amount of retries and the total time.
Or you will be able to change reconnectBackoffInitialDelay to 5 and reconnectBackoffFactor to 1 - this configuration changes behavior to try each 5 seconds.
These configuration parameters will be available in the next release. They are expected to be on the same level with url configuration (in server section).
Thank you for the quick addition to the code. Will certainly configure this when the new release comes out!