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
- Asynchronous read and write with the EasyUAClient example?
Asynchronous read and write with the EasyUAClient example?
If you decide to upgrade to version 5.32 from any previous version, please pay attention to the "What's New" document, and particularly to the change where the runtime assemblies are no longer installed into GAC by default. For this reason, it is highly recommended that you *uninstall* any previous version first, instead of simply applying version 5.32 over the existing installation.
Best regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- rvbr@allseas.com
- Topic Author
- Offline
- Premium Member
- Posts: 8
- Thank you received: 0
I rewrote my (to be production) code using the "OpcLabs.EasyOpc.UA.Reactive" interface. This is a far better match, when using the OPCLabs UA client in combination with the TPL Dataflow framework and a lot of async/await stuff.
Will do some more testing with the reactive extensions approach tomorrow
Please Log in or Create an account to join the conversation.
Anyway, there is a work to be done. I will keep you informed about the progress.
Best regards
Please Log in or Create an account to join the conversation.
- rvbr@allseas.com
- Topic Author
- Offline
- Premium Member
- Posts: 8
- Thank you received: 0
Basic steps to produce this problem:
- Run more than 64 parallel requests with the EasyUAClient with the Isolated value set to TRUE (in this case a Parallel.Foreach with 100 instances).
- The attached example does a read value before the subscription (but I don't think its needed to reproduce the problem).
After the "The number of WaitHandles must be less than or equal to 64." exception, the OPC Labs sample server is also broken, as it will no longer accept subscriptions. The sample server service needs to be restarted before is works again!
PS. Please keep in mind that this code is no production code, but just a quick test to reproduce the problem!
Please Log in or Create an account to join the conversation.
For "A first chance exception of type 'Opc.Ua.ServiceResultException' occurred in Opc.Ua.Core.dll", the details are missing from your report - the actual service result that indicates the problem would help.
The "BadTooManySubscriptions" does not mean that the server is broken, it just means that you have reached its limitations. The OPC UA sample server comes from OPC Foundation.
I would be highly interested in seeing the call stack from the exception "The number of WaitHandles must be less than or equal to 64." - can you provide it if you see it again please? The reason for it as that we are well aware of the "64" limitation, and we have code to overcome this limitation - but it looks like you have encountered a situation where it can still happen.
Note: I assume that you are not debugging the problems using breakpoints - because, it is not possible. The principle of the OPC UA keep-alive mechanism cannot coexist with pausing the client program for extended periods of time. We are trying to make the situation a little better - there is a discussion about it in the documentation - but the conclusion still holds, breakpoints won't work well with keep-alive.
Please Log in or Create an account to join the conversation.
- rvbr@allseas.com
- Topic Author
- Offline
- Premium Member
- Posts: 8
- Thank you received: 0
I ditched the synchronous read that I did before a subscription. So now I have to wait until the first sensor update before all the data is initialized. This will not be practical for all data sources, but we will cross that bridge when we get there.
But the question still remains: Is it possible to do asynchronous read/write operations on the UA client (like on the .NET and DA client)?
Please Log in or Create an account to join the conversation.
- rvbr@allseas.com
- Topic Author
- Offline
- Premium Member
- Posts: 8
- Thank you received: 0
The .Isolated makes the behavior even less predictable:
- The subscriptions will still get the: "The OPC-UA subscription publishing has stopped." exception.
- The synchronous read will produce a: "A first chance exception of type 'Opc.Ua.ServiceResultException' occurred in Opc.Ua.Core.dll" exception.
The subscriptions will also fail to recover from there "The OPC-UA subscription publishing has stopped." exception (or it takes way longer).
If you push the number off instances a bit further then a additional exception occurs:
"A first chance exception of type 'Opc.Ua.ServiceResultException' occurred in Opc.Ua.Core.dll
OPCStressTest.vshost.exe Warning: 0 : * Transformed from: An exception of type 'Opc.Ua.ServiceResultException' from source 'Opc.Ua.Core' has occurred in OPC-UA SDK action 'DiscoveryClient.GetEndpoints'. The exception descend follows.
(1) {Opc.Ua.ServiceResultException} Opc.Ua.Core(End) -> Error establishing a connection."
All these blocked tasks will eventually result in the final neck shot exception: "The number of WaitHandles must be less than or equal to 64.".
Side note: I was able to "break" the OPCLabs sample server, it returns the following exception for a subscription request (even from the EasyOPC-UA Demo Application):
"OPC-UA service result - BadTooManySubscriptions.
---- SERVICE RESULT ----
StatusCode: {BadTooManySubscriptions} = 0x80770000 (2155282432)"
While exploring all these possible ways of breaking stuff can be fun and useful, I like to go back to my original question.
Is it possible to do asynchronous read/write operations on the UA client (like on the .NET and DA client)?
Please Log in or Create an account to join the conversation.
If so, I can think of two possible remedies:
1. Tweak the parameters of the keep-alive. I think we have some public parameters available for this. Let me know if you are interested in following this route, and I will try to look up more info.
2. Use one session for the subscriptions, and a separate session (or sessions) for blocking reads and writes. This can be enforced by the mechanism I mentioned in the earlier post, i.e. setting the .Isolated flag on the EasyUAClient as needed.
Best regards
Please Log in or Create an account to join the conversation.
- rvbr@allseas.com
- Topic Author
- Offline
- Premium Member
- Posts: 8
- Thank you received: 0
I can set up +100 parallel tasks that subscribing to the OPCLabs sample server, but when I do the same to the KEPServerEX 5 it gets really slow. Especially when I perform a read before adding the subscription.
When the subscription is running and I start additional reads (by adding tasks or separate program) then the running subscriptions will return the following exception: "The OPC-UA subscription publishing has stopped."
When I stop the separate program the connections will recover after a while.
So it seems that the synchronous read and write actions are blocking the connection to KEPServerEX
Its also possible to let the synchronous read fail, but I can't reproduce the issue currently.
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-UA in .NET
- Reading, Writing, Subscriptions
- Asynchronous read and write with the EasyUAClient example?