‎05-11-2017 06:35 AM - edited ‎05-11-2017 06:36 AM
Hello,
I stumbled over some unexpected behaviour while trying to access parent class data using an accessor in the Actor Core of the child class.
Here's an outline of my project:
However, I noticed that 'Read Proxy Enq.' returns an invalid enqueuer if called from 'Cam UI's Actor Core. If I call 'Read Proxy Enq.' in one of 'Cam UI's methods it works as expected.
Any idea what I might be missing?
Thanks in advance!
‎05-11-2017 07:04 AM
First guess: your call from Actor Core returns an invalid enqueuer because the correct data value has not been written to the private data yet (Race Condition) or 'Read Proxy Enq." is being passed a "wrong" object...
Can you post a screenshot of your Actor Core?
‎05-11-2017 07:37 AM
Thanks, I think I figured it out: Race condition was the key word.
I think, 'Cam UI's Actor Core runs before 'Client UI's (?). But since I launch the Network Endpoint Actor as a nested actor in 'Client UI's AC, the enqueuer reference is still invalid at the time 'Cam UI's AC wants to access it.
Which makes me wonder if that is always the case or if all ACs of parent and child actors run at the same time?
‎05-11-2017 08:45 AM
@pktl2k wrote:
...
I think, 'Cam UI's Actor Core runs before 'Client UI's (?). But since I launch the Network Endpoint Actor as a nested actor in 'Client UI's AC, the enqueuer reference is still invalid at the time 'Cam UI's AC wants to access it.
Yes and No.... Data Flow-wise, "Cam UI's Actor Core will start executing until the Parent Call of Actor Core.vi is reached
(Note: for the ease of understanding I'm ignoring parallel loops in Actor Core.vi at this time).
The Parent Call will jump to 'Client UI's Actor Core.vi, again executing is to the Actor Core call of its' parent calls... eventually executing the message handling loop of the ultimate Actor Core.vi of the Actor class.
I think your race condition happens somewhere along the way.... maybe the enqueuer written to the object in ClientUI:Actor Core.vi before invoking the parent call....
I have to admit I am not very confident with the Network Endpoint Actor.
‎05-11-2017 09:58 AM
Unless you can prove otherwise, it's not a race condition. Proxies are established in Actor Core, so any attempt to access that before passing the object along to the Call Parent Node will fail. Nothing racy about it -- it's completely deterministic.
I get a bit twitchy about people claiming "race condition". If one existed, that would be a severe bug that we would need to patch. This is just an order of operations problem as far as I can tell. Please post evidence if you see such to the contrary.
‎05-11-2017 11:54 AM
@AristosQueue (NI) wrote:
Unless you can prove otherwise, it's not a race condition. Proxies are established in Actor Core, so any attempt to access that before passing the object along to the Call Parent Node will fail. Nothing racy about it -- it's completely deterministic.
You're right, to call this a race Condition is wrong.
‎05-12-2017 01:49 AM
No, not a race condition. Just ignorance about which part runs first.
Thanks for your insight!
‎05-12-2017 10:09 AM
*phew* 🙂