Subscription is not working after Reconnecting a Connection

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
rainmang
Full Member
Full Member
Posts: 5
Joined: 13 Feb 2017, 14:26

Subscription is not working after Reconnecting a Connection

Post by rainmang »

I just created a small test application which is creating a connection and a subscription to read a simple boolean variable. After stopping the OPC UA server and restarting the server, the connection is reconnected and the subscription is (re)created. However after everything looks fine. Variable changes are not reported by the application anymore. To create the output shown below I am just monitoring the ConnectionStatusUpdate Event of the session and the DataChanged and StatusChanged Event of the subscription. I would expect to have some more Data Changed Events comming up after the last line of the log file as some more times the state of the variable was changed.

Output of the log file please see below
Session created.
Session >>> Old Status: Disconnected -- New Status: Connecting -- Error: Good
Session >>> Old Status: Connecting -- New Status: Connected -- Error: Good
Reconnect: True
ReconnectDelay: 5000
Subscription >>> Old Status: Deleted -- New Status: Created -- Error: Good
001 -- Subscription Variable changed to NewVal: True
002 -- Subscription Variable changed to NewVal: False
003 -- Subscription Variable changed to NewVal: True
004 -- Subscription Variable changed to NewVal: False
005 -- Subscription Variable changed to NewVal: True
006 -- Subscription Variable changed to NewVal: False
007 -- Subscription Variable changed to NewVal: True
008 -- Subscription Variable changed to NewVal: False
009 -- Subscription Variable changed to NewVal: True
010 -- Subscription Variable changed to NewVal: False
Subscription >>> Old Status: Created -- New Status: WarningKeepAliveLate -- Error: BadCommunicationError
Session >>> Old Status: Connected -- New Status: ConnectionWarningWatchdogTimeout -- Error: UncertainSubNormal
Session >>> Old Status: ConnectionWarningWatchdogTimeout -- New Status: ConnectionWarningWatchdogTimeout -- Error: UncertainSubNormal
Session >>> Old Status: ConnectionWarningWatchdogTimeout -- New Status: ConnectionErrorClientReconnect -- Error: BadCommunicationError
Session >>> Old Status: Connected -- New Status: SessionAutomaticallyRecreated -- Error: Good
Session >>> Old Status: ConnectionErrorClientReconnect -- New Status: Connected -- Error: Good
Subscription >>> Old Status: WarningKeepAliveLate -- New Status: Deleted -- Error: Good
Subscription >>> Old Status: Deleted -- New Status: Created -- Error: Good
---------------------------------------------------------------------
Everything is looking good here Session is connected again, Subscription is (re)created, without my interaction, however no variable changes are being reported.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3071
Joined: 18 Mar 2011, 15:09

Re: Subscription is not working after Reconnecting a Connect

Post by Support Team »

Please create a support ticket at https://webdav.unifiedautomation.com/su ... _form.html.
Create and attach a trace file with trace level ProgramFlow. We can use this file for analysing what is happening.
Best regards
Unified Automation Support Team

User avatar
Support Team
Hero Member
Hero Member
Posts: 3071
Joined: 18 Mar 2011, 15:09

Re: Subscription is not working after Reconnecting a Connect

Post by Support Team »

After a reconnect the client recreates the subscriptions tries to create all MonitoredItems in one service call. However the MayMessageSize configured at the server is very small, so the CreateMonitoredItems call fails. You can increase the MaxMessageSize on server side or create the MonitoredItems in chunks. Please see ClientSettings.MaxOperationsPerRequest
Best regards
Unified Automation Support Team

mababin2
Jr. Member
Jr. Member
Posts: 1
Joined: 05 Jul 2018, 14:11

Re: Subscription is not working after Reconnecting a Connect

Post by mababin2 »

Hi,

I've been searching about the following connection status change on reconnect (Shuting down the Server and Starting it) and this post is the only one I found online.

Session >>> Old Status: ServerShutdown-- New Status: ConnectionErrorClientReconnect-- Error: UncertainSubNormal
Session >>> Old Status: Connected -- New Status: SessionAutomaticallyRecreated -- Error: Good
Session >>> Old Status: ConnectionErrorClientReconnect -- New Status: Connected -- Error: Good

I always get those two logs in this exact order. Is this a normal behaviour ?

It feels like there is a missing connection status change to go from SessionAutomaticallyRecreated to ConnectionErrorClientReconnect.

I'm currently raising an event in my system when Status goes from connected to anything else and an event when it goes from anything else to Connected.

Is SessionAutomaticallyRecreated only some kind of log information ?

Can I simply ignore the SessionAutomaticallyRecreated and assume that there will never be any connection status change going from SessionAutomaticallyRecreated to anything else ?

Thank you very much !

Post Reply