Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

NullReferenceException on Large Subscriptions

More
09 Apr 2021 20:30 #9591 by gkalipershad
Thanks, Z, I will let you know.

By the way, it is actually sounding like the user is reading data out of a SQLite DB, and then using their Data Client App to write values to the TOP Server. This is different than what my previous understanding was, so I am not sure where the Subscriptions comes into play.

We are planning to have a call with the customer on either Monday or Tuesday to try and understand better.

Regards,
GK

Please Log in or Create an account to join the conversation.

More
09 Apr 2021 10:59 #9589 by support
G.,
thanks for update. Yes, please try to get some reasonable repro; let me know when you have more info.

If we end up without a repro, I still may have one thing in my sleeve: A code change that might help. But, I am unsure whether it will, or not. It would be better to have a repro and then fix the true cause, rather than trying this blindly.

Best regards

Please Log in or Create an account to join the conversation.

More
08 Apr 2021 22:02 #9587 by gkalipershad
Z,

I apologize that our team never got back to you on this. I have not been as involved in this case as ZParham has, but I know some details.

Unfortunately, the exception does not occur when the device is set to simulated mode. I am not sure if the target hardware was ever disconnected as a test, but I will check on that.

We received a "sample" of the application, but when I saw it, the application was still massive. I will try to circle back and see what happens if we just subscribe from the EasyOpcUADemo.

Thanks,
GK

Please Log in or Create an account to join the conversation.

More
20 Mar 2021 09:36 #9520 by support
Hello,

thank you for more information. I still do not know the reason, but one thing occurred to me: The customer mentioned that he is using TopServer. That can make things easier, because it is not an embedded PLC server or something difficult to get our hands on.

Does the problem also occur also if the target hardware is disconnect from the server? Or maybe when simulation tags from the server are used instead of the real ones? In both these cases, it should be possible that the customer sends us the TOP Server configuration, and a piece of his code that does the subscriptions, and we should be able to reproduce the problem and then fix it.

Best regards

Please Log in or Create an account to join the conversation.

More
19 Mar 2021 15:29 #9518 by ZParham
I apologize for the wait. I have received a response from the end user, as I am unable to access the working version. He was unable to provide accurate time measurements, as it was too quick to measure. I have included his responses to the questions below.

1) It appears that the time taken to subscribe 100 Tags is not faster or slower than to subscribe to 1000 tags in both versions.

2) The Time is not human measurable, but it seems a bit random on the Number when the Fault occurs. Sometimes ten times it's on Tag number 500, then change the Subscription amount and its later or earlier.

And I did some tests with the newest Version and I changed the Subscription Max amount:

Max: Fault Occurred on Tagnumber(reproducable) (Number read from TopServer where it stops to subscribe)
1000 = 620
800 = 500
600 = 587
500 = no Exception

Please Log in or Create an account to join the conversation.

More
09 Mar 2021 08:27 #9484 by support
Hello,
thanks for detailed description.

It is unlikely that the client is doing anything wrong. And, it is not clear why the behavior has changed between versions 5.58 and 5.59 : I have checked, and I do not see any apparent change between the version that could cause it; the input argument checking also is not related to it.

Can you please try to identify a reproducible scenario?

I have identified one suspicious area in the code, and have some questions that would hopefully allow me to determine whether I am on the right track:

1. Does it take long to subscribe these 600 tags - in version 5.58? How long roughly?
2. How long is the time in version 5.59 between the invocation of SubscribeMultipleMonitoredItems, and the NullReferenceException? About the same as in (1)?

Thank you

Please Log in or Create an account to join the conversation.

More
08 Mar 2021 15:25 #9483 by ZParham
I have a customer who is updating his previously working code to the 5.59 release of OPC Data Client. The code was working on 5.58.

This project takes tag values from a Beckhoff TwinCAT PLC via TOP Server. The tag names and locations are set in a SQLite Database, which is loaded during the runtime.

When he subscribes to more than approximately 600 tags, a Null Reference Exception is thrown. We recognize that the cause for this change in behavior from 5.58 to 5.59 is that input arguments are now consistently checked for nullness of their elements before a method body is executed. However, the customer needs clarification on the cause of the exception. Unfortunately, stepping through with breakpoints has not provided him with much clarification. When checking with other clients, no tag values appear to be null.

I believe this has to do with the data from the PLC, but that the customer wants to understand the error better so he can know where to look for on the PLC side. I have been working on replicating the error in case it is necessary, but I am absolutely not expecting you to replicate or fix the issue unless you believe there is something that can be done on the Data Client side.

I have included the exception below. Please let me know if you have any questions!

System.NullReferenceException: Object reference not set to an instance of an object.
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.AddMonitoredItemsToSdkSubscription(IEnumerable`1 clientMonitoredItemEnumerable, UAUpdateContext updateContext)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.ChangeMonitoredItemsInSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd, UAUpdateContext updateContext)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.ChangeMonitoredItemsInSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.InternalPerformSdkSubscriptionChanges(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.<PerformSdkSubscriptionChanges>b__84_2(IReadOnlyList`1 itemsToAddChunk)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.<>c__DisplayClass2_0`1.<ChunkProcess>b__0(IReadOnlyList`1 list)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.ChunkSelect[TInput,TOutput](IReadOnlyList`1 readOnlyList, Func`2 chunkSelector, Int32 chunkSize)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.ChunkProcess[TInput](IReadOnlyList`1 readOnlyList, Action`1 chunkProcessor, Int32 chunkSize)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.PerformSdkSubscriptionChanges(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.ManipulateSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.TryManipulateSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionLocker.OnLastUnlock()
at OpcLabs.BaseLib.Algorithms.Internal.Locker.Unlock()
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.UnlockMonitoredItems()
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.EasyUAClientEngine.<>c.<SubscribeMonitoredItems>b__38_0(UASmartClientSubscription subscription)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.EasyUAClientEngine.SubscribeMonitoredItems(NetSdkEasyUAClient easyClient, EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray, EasyUAAdaptableParameters adaptableParameters)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.NetSdkEasyUAClient.InternalSubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.NetSdkEasyUAClient.<>c__DisplayClass37_0.<SubscribeMultipleMonitoredItems>b__0()
at OpcLabs.BaseLib.DisposableObject.DisposeGuard[TResult](Func`1 func)
at OpcLabs.BaseLib.DisposableObject.DisposeGuardNotNull[TResult](Func`1 func)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.NetSdkEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.MultiplexingEasyUAClient.<>c.<SubscribeMultipleMonitoredItems>b__12_0(IEasyUAClient client, IReadOnlyList`1 list)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.SwitchCase[TInput,TOutput,TKey](IReadOnlyList`1 readOnlyList, Func`2 keySelector, IEqualityComparer`1 keyComparer, Func`3 outputSelector)
at OpcLabs.EasyOpc.UA.Implementation.MultiplexingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.EasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at Buhler.Connectivity.OPCUA.QuickOPCClientComm.Subscribe(IList`1 IOs) in E:\_Projekte_VisualStudio\_GLC\GLC Tools\Main\Sources\Buhler.Connectivity.OPCUA\QuickOPC\QuickOPCClientComm.Subscribe.cs:line 121

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.088 seconds