Forum Discussion
EnTerr
10 years agoRoku Guru
"tar" wrote:
So here is a major problem:
1. The app heavily relies on m.global and accesses it's fields from Task nodes
2. Recently I've discovered that sometimes m.global fields are invalid (however returns valid objects when stopped in debugger)
3. As I have a solid programming background, I've guessed it is due to some threading issues and found this topic in docs https://sdkdocs.roku.com/display/sdkdoc/Scene+Graph+Threads#SceneGraphThreads-TaskNodeThreadRendezvousTimeout
Does it mean that m.global fields are not reliable to access from TaskNode at all???
...
Is there a way to avoid invalid responses when accessing m.global fields?
Is there any global storage (accessible from any thread) that does not rely on render thread as m.global?
Yes. No. And mostly no.
It's not only `m.global` fields that are unreliable - rather, any and all fields of a RSG node are unreliable to access between threads!
I put it in red because think is very important issue to grasp. Regardless if you set or get the field - or if you do it explicitly with .getField()/.setField() - or with "."-access. Beware there will be no error though - if you are setting a field, it just won't get set - and if you are getting it, it will return `invalid`.
Yes, i know - that is horrible. In my not-so-humble opinion, this (d)effect is the 2nd worst, the 2nd most crippling mistake of RSG. The good news is, seems there is something in the works to patch this in future release - but it has its own issues. See BUG-0025 "Debug rendezvous with Godot" for details if you are part of the developer beta.