- Posts: 89
- Thank you received: 2
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.
- Forum
- Discussions
- QuickOPC-UA in .NET
- Reading, Writing, Subscriptions
- NullReferenceException on Large Subscriptions
NullReferenceException on Large Subscriptions
- gkalipershad
- Offline
- Platinum Member
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.
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.
- gkalipershad
- Offline
- Platinum Member
- Posts: 89
- Thank you received: 2
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.
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.
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.
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.
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.
- Forum
- Discussions
- QuickOPC-UA in .NET
- Reading, Writing, Subscriptions
- NullReferenceException on Large Subscriptions