Quantcast
Channel: OPC Labs - OPC Labs - Recent Topics - OPC Labs Online Forums
Viewing all articles
Browse latest Browse all 1794

EasyDAClient fails to release connection after unsubscribe call. - by: ncorbett

$
0
0
Good Morning,

Software version: OpcLabs.QuickOpc Nuget Package: 5.71.123

We are using an EasyDACLient.

We appreciate with EasyDAClient the connection is maintained on demand where it will be established by the library to support each of the subscription, write and read activities.

We have the requirement to release the connection and we do this by:
• Ensuring no calls are made to read or write methods.
• Unsubscribe calling UnsubscribeAllItems()

Scenario:
We are using an EasyDAClient instance to connect with a Server where we do the following:

a) Register and verify our license using the RegisterManagedResourceWithExistenceCheck()
This is successful.

a) Register a callback with ItemChanged for change notifications for subscriptions.

a) Subscribe for change notifications using SubscribeMultipleItems(…)

In this scenario at this point we have an immediate need to close the connection. The service in which the connection is established is closing.

In this case we:
a) Ensure no read or write calls are made.
b) We call UnsubscribeAllItems() on the EasyDAClient.
c) We unregister the callback handler from ItemChanged on the EasyDAClient.
d) We call Dispose() on the EasyDAClient object.

At this point we expect the Connection with the server to be released and all activity with the server to cease.

However we observe:
• The connection at the server remains open.
• It appears that the subscription with the server remains.
• It takes approximately 9min for the connection to be released at the server.

Please note:
• The call to SubscribeMultipleItems() appears successful. No error or exceptions can be seen.
• The call to UnsubscribeAllItems() appears successful. No error or exceptions can be seen.
• The call to UnsubscribeAllItems() is made after SubscribeMultipleItems() albeit the call to UnsubscribeAllItems() is made before any notifications are received or any read/write actions are performed.

We suspect that the UnsubscribeAllItems() is not being serviced correctly possibly due it is being made before SubscribeMultipleItems() has been serviced completely, and as a consequence the subscription with the server is not been released, which is then preventing the connection to the server from being released.

We have no evidence of this.

Questions:
• Are there any logs that can be enabled for the EasyDAClient that would allow us to observe the internal behaviour of the QuickOPC client library in this scenario and appreciate why the subscriptions and connection is not being released as expected?
• Are there any race conditions between calling SubscribeMultipleItems() and UnsubscribeAllItems() that we should be aware of?
• If there are race conditions between calling calling SubscribeMultipleItems() and UnsubscribeAllItems() is there any state (synchronisation objects) on which we can wait that indicates SubscribeMultipleItems() has completed and it is now safe to call UnsubscribeAllItems()?

Kind regards, ncorbett.

Viewing all articles
Browse latest Browse all 1794

Latest Images

Trending Articles



Latest Images