Subscription ID changed after re-establishing connection

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

Moderator: uasdkcpp

Post Reply
q1109820469
Jr. Member
Jr. Member
Posts: 4
Joined: 23 May 2018, 08:13

Subscription ID changed after re-establishing connection

Post by q1109820469 »

Hi Team,

I have a question about the correct behavior of the subscription when the re-establishing connection.

Background:
After a Client establishes a connection to a Server and creates a subscription, if I stop the Server, the Client loses the connection to the Server. Then I start the Server again. The Client will build the re-establishing connection.

Situation:
I used the UaExpert as the Client and captured the log by Wireshark. I found the subscription ID was different before and after the reconnection. It means a new subscription was created. However, the subscription should not change after the re-establishing connection, based on the spec.

According to the chapter "6.7 Re-establishing connections" of the OPC Unified Architecture, Part 4, Release 1.04, the subscription should be "awaken" instead of creating a new subscription unless the re-establishing connection fails.
Quote:
the Client shall re-establish the connection by creating a new SecureChannel and activating the Session with the Service ActivateSession. This assigns the new SecureChannel to the existing Session and allows the Client to reuse the Session and Subscriptions in the Server. To re-establish the SecureChannel and activate the Session, the Client shall use the same security policy, application instance certificate and the same user credential used to create the original SecureChannel. This will result in the Client receiving data and event Notifications without losing information provided the queues in the onitoredItems do not overflow.
The Client shall only create a new Session if ActivateSession fails. TransferSubscriptions is used to transfer the Subscription to the new Session. If TransferSubscriptions fails, the Client needs to create a new Subscription.


Outstanding Question:
Is this an expected behavior?

Thanks!

q1109820469
Jr. Member
Jr. Member
Posts: 4
Joined: 23 May 2018, 08:13

Re: Subscription ID changed after re-establishing connection

Post by q1109820469 »

There are 2 attachment, "reconnection.pcapng" and "Reconnect_Sequence.png''. You can download attachments on "ftp://ftp.ni.com/outgoing"
In the Wireshark log, at the #282, the subscriptionID is 792897632. But after the reconnection, the subscriptionID is 1513406549 at the #683.

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

Re: Subscription ID changed after re-establishing connection

Post by Support Team »

Hello

you say
if I stop the Server, the Client loses the connection to the Server. Then I start the Server again.
What exactly are you doing here on the server side?
Best regards
Unified Automation Support Team

brudert
Sr. Member
Sr. Member
Posts: 14
Joined: 29 Jun 2016, 10:40

Re: Subscription ID changed after re-establishing connection

Post by brudert »

I have a similar issue.

UaExpert creates new subscription everytime you reconnect to the server.

So, it is not possible to simulate the scenario where a subscription still exists from another session and take it over to the new session.
But as q1109820469 correctly quoted, this should be possible, right? But how?

Regards,
B.R.

Post Reply