Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Reconnect subscription after onLifetimeTimeout
February 6, 2024
18:32, EET
Avatar
amj005
Member
Members
Forum Posts: 33
Member Since:
July 27, 2021
sp_UserOfflineSmall Offline

Hi,

Can you suggest how to recreate or reconnect subscription and monitoreddata items, once we receive onLifetimeTimeout?
We are doing this, because we need application to read continuously without breaks, and if timeout happens, we will try to reconnect.

Can we follow below steps?
subscription.removeItems()
client.removeSubscritpion(sub)
Create new subscription and monitored items objects.
client.addSubscription(subscriptionNew)
subscriptionNew.addItems(monitoredDataItemsNew)

Let us know if anything else needs to be take like remove listeners.. Or any other better way.

Also. is there a way to not use lifetimetimeout? Or just rely on prosys to handle the reconnections if any issue with the subscription?

Thanks.

February 7, 2024
13:54, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Just doing

UaClient.removeSubscription(Subscription)
UaClient.addSubscription(Subscription)

should be enough.

Though, without a connection break scenario it would be an error in practice if the onLifetimeTimeout happens. Even the keepalive timeout is, because the server should be sending at least a keepalive (each maxkeepalive count times publishinterval, plus some additional time to account network transfer delay).

If there IS a connection break, in most cases SDK should detect that (as it cannot read the server state) and enter into a reconnect mode. Once it connects back again it will redo the subscriptions (if they cannot be TransferSubscriptioned i.e. they were not alive anymore on the server).

What SDK version you are using? Handling of this has been increased along the versions.

February 7, 2024
16:18, EET
Avatar
amj005
Member
Members
Forum Posts: 33
Member Since:
July 27, 2021
sp_UserOfflineSmall Offline

Hi,

Thats interesting. Thanks for information.

Version we are using: 4.9.0-43

Handling lifetimecount:
So, how do you suggest to handle the onLifetimeTimeout() ?
Should we handle it differently for communication break ? And some resubscribe logic for other scenarios?
If we should handle differently, how do we check if it was triggered by communication break? Can you point to particular variable that will be helpful.
And if we do not handle communication break manually, how long we should wait ? And how we make sure the application is resilient ?
What can we add to make sure it is self healing, if something goes wrong and has stopped or broken the subscription? Like a time to time check heartbeat or status and resubscribe or restart subscription..

Regarding issue:
Yes, presently we see it is communication break.. And eventually, seeing lifetimeTimeOut().
And in our case, we see communication break around 1 hour time and connection getting established within minute or so.
But subscription is stopped sending data and also sometimes eventually we are seeing timeouts.

Thanks.

February 8, 2024
11:39, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1010
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

I would recommend to upgrade to the lest version 5.1.0 – or at least 4.11.0. There have been refinements to the reconnection logic and basically, the subscriptions should recover from connection break in every situation, although it has been very tricky to get it to work properly always with every server. Therefore, the notifications from the SubscriptionAliveListener are more or less indications that something unexpected is happening. And if this happens, you might be better to use remove/addSubscription to make sure it get recreated to the server.

If the problem persists after the upgrade, please contact the support by email, so we can inspect it further.

February 8, 2024
13:00, EET
Avatar
amj005
Member
Members
Forum Posts: 33
Member Since:
July 27, 2021
sp_UserOfflineSmall Offline

Okay. Thanks.
We will look into and get back.

February 8, 2024
17:55, EET
Avatar
amj005
Member
Members
Forum Posts: 33
Member Since:
July 27, 2021
sp_UserOfflineSmall Offline

Hi,

In the mean time, while we update the version, we are seeing peculiar issue related to this.
Can you please provide pointers on this?

We are seeing communicaitonFault with server after about an hour. And it comes back and reconnects, sometimes within a minute itself.
But after successful reconnection, we do not see any data coming in for the connection or subscription.
After some time the lifetime timeout is triggered..

What could be going wrong here? We have not seen like this earlier.

Thanks.

February 9, 2024
9:57, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1010
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Which server is that?

I know that the OPCF demo server at opc.tcp://opcua.demo-this.com:51210/UA/SampleServer, for example, restarts once an hour.

The security token is also renewed once an hour and there have been hick-ups related to that with some servers. Those issues should be resolved in the latest releases, so again, better to check with that.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
26 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 683

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1