View Issue Details

IDProjectCategoryView StatusLast Update
0000981.NET APIImplementation Bugpublic2010-12-20 01:44
Reporterozgurberksoy Assigned ToRandy Armstrong  
PrioritynormalSeverityminorReproducibilitysometimes
Status resolvedResolutionfixed 
Summary0000981: .NET API 2.00 - Client Handle Problem with first data changed callback
Description

In "AddItems" method of "OpcCom.Da.Subscription", item handles delivered by clients are translated to internal handles (starting from 1 and increased by 1 for each item), and after "((IOPCItemMgt) m_group).AddItems" call "m_items" table is initialized with the item handles delivered by client.

Problem occurs if a data change callback comes from server before/during "m_items" initialization. Callback is executed and client receives server handles from net api in data changed callback. (our client's item handles are starting from 0 and increased by 1 for each item and this is the cause of the shift on display)

Here are the steps to reproduce the problem:

  • Create and activate subscription for many DA items with client handles starting from 0 and increased by 1 for each item

  • Place a breakpoint in "OpcCom.Da.Subscription.AddItems" right after "((IOPCItemMgt) m_group).AddItems" call

  • Wait a few seconds, then remove breakpoint and continue execution (in this time interval data change callback from the server will be executed by .NET API, and results will be delivered to client)

  • Observe data changed client handles on the client (internal NET API item handle values should be observed here - starting from 1 and increased by 1 for each item)

Additional Information

Performing locking on AddItems and DataChange functions solves the problem, as callbacks won't be executed till "m_items" table is initialized. Please see attachment "OpcCom.Da.Subscription.cs".

TagsNo tags attached.
Attached Files
OpcCom.Da.Subscription.cs (70,493 bytes)   
OpcCom.Da.Subscription.cs (70,493 bytes)   

Activities

Holger Witting

2010-06-18 13:10

reporter   ~0001902

Last edited: 2010-06-18 13:12

The "m_items" table need to be initialized BEFORE the call to AddItems. (see OPC DA Specification IOPCItemMgt::AddItems: "Note that if an Advise is active, the client will begin receiving callbacks for active items. This can occur very quickly, perhaps even before the client has time to process the returned results. The client must be designed to deal with this.")
Every ClientHandle reported before the AddItems call finished is wrong !

Randy Armstrong

2010-12-20 01:44

administrator   ~0002201

Fixed as suggested.

Issue History

Date Modified Username Field Change
2010-03-11 09:45 ozgurberksoy New Issue
2010-03-11 09:45 ozgurberksoy File Added: OpcCom.Da.Subscription.cs
2010-06-18 13:10 Holger Witting Note Added: 0001902
2010-06-18 13:12 Holger Witting Note Edited: 0001902
2010-12-20 01:44 Randy Armstrong Status new => resolved
2010-12-20 01:44 Randy Armstrong Resolution open => fixed
2010-12-20 01:44 Randy Armstrong Assigned To => Randy Armstrong
2010-12-20 01:44 Randy Armstrong Note Added: 0002201