Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Method call order not respected
April 10, 2018
12:14, EEST
Avatar
Xavier
Member
Members
Forum Posts: 43
Member Since:
March 26, 2014
sp_UserOfflineSmall Offline

Hi,

I created nodes using UaModeler and the Codegen tool. Some nodes have methods.
I call these methods using a C++ SDK.

I have noticed that if the methods are called in synchronous mode, it’s working well.
If I call the same methods in asynchronous mode and fast, then the method implementations are not always called in the right order. For instance if my node has 3 methods A, B and C and If I call them in this order almost at the same time, in the server implementation it can be B, C then A.

Using Wireshark I can see that the method are called in the right order on the network, but also that all the calls are in the same OPC-UA packet.

I believe this is multithreaded for performance reasons but is there a way for me to keep the calling order?

Thanks,

April 10, 2018
15:38, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, the Java stack uses the internal thread pool to handle each service request separately. And this in practice makes it probable that the order of the actual handling time in your application is random, if the messages arrive at the same time.

I assume that you are making a separate CallRequest for each method from the client application. If you would make a single CallRequest, containing all methods in the order that you wish them to be executed, it should work better: in this case the server should handle the request in one thread and execute the method calls in the original order.

That said, I am not quite sure how you should make a CallRequest with several method calls in it with the Unified Automation C++ SDK. UaSession.beginCall seems to take just one method as an argument…

April 10, 2018
17:03, EEST
Avatar
Xavier
Member
Members
Forum Posts: 43
Member Since:
March 26, 2014
sp_UserOfflineSmall Offline

Thank you for the confirmation and the suggestion, I think I will try this in the future.

But I also found out that in the server side the “serviceContext.getTimestamp()” is set somewhere, I believe in the caller stack, and it seems to be really precise. I can make 300 async calls in less than 4 ms but they all have a different (and right) timestamp.

This allows me to be OK in my use case (I can just ignore older requests).

So in this case if I receive B A C, I know I can ignore A because its timestamp is older than the one of B.

April 10, 2018
17:52, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Very good.

Actually, there is UaSession.callList, which can call several methods at the same time – but there is no async version of that available at the moment.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 729

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1