12-02-2024 11:51 AM - edited 12-02-2024 11:53 AM
I had a program that had (what I thought was) a race condition and/or stale data occurring once in a while. This program had overuse of, and unnecessary use of, the Request Deallocation function. I did a quick cleanup of some code and deleted all of the Request Deallocation functions. Much to my surprise, the issue went away. During cleanup, I'm certain I didn't change dataflow. Nothing was deleted or moved, just wire cleanups.
p.s. It's too late now to put back in the Request Deallocation functions to see if the problem reoccurs. Long story there.
12-02-2024 03:37 PM
I don't think it could, but I'm not sure. It's much more likely that it recompiled differently and now what needs to win the race is winning.
12-02-2024 09:46 PM
@billko wrote:
... It's much more likely that it recompiled differently and now what needs to win the race is winning.
This is one explanation I had in mind because I think I saw the program fix itself once when the Request Deallocation was put inside a loop rather than outside of it. I can see how moving and/or deleting RD can change performance, but I can't see how it could influence data.
12-03-2024 12:13 AM - edited 12-03-2024 12:28 AM
Use of Request Deallocation is extremely seldom useful (my guess is it’s below 0.01%). Outside of this rare unicorn case it is at best making the work of the LabVIEW compiler a lot more difficult, and always a performance nightmare!
it could also expose a bug in LabVIEW with data being handled unsafe but that is extremely unlikely. Such unsafe data handling would in one way or the other be exposed without Request Allocation too, and rather sooner than later!
But your code almost certainly has races somewhere.that by pure chance were seemingly “fixed” by the removal of one or more of those nodes. My educated guess is that whoever wrote that program found out by accident that adding a Request Deallocation magically fixed their race induced problem and from then on got the get to go method of “fixing” any strange results, rather than getting rid of concurrent global data access.
12-03-2024 02:59 AM
After seeing AQ's E-CLA presentation (don't remember its name), I learned that the use-case for "request deallocation" is so extreme that it should in practice never be used. How it ended up in the palette is a mystery. The context help misguides the user into thinking that it is a good thing to sprinkle the code with this node.
12-03-2024 07:18 AM
@rolfk wrote:
Use of Request Deallocation is extremely seldom useful (my guess is it’s below 0.01%). Outside of this rare unicorn case it is at best making the work of the LabVIEW compiler a lot more difficult, and always a performance nightmare!
In my 20 years of LabVIEW experience, I have successfully used Request Deallocation once. Even then, I'm not completely sure I was using it correctly (it was ~15 years ago and I don't have access to the code to see if I could handle the data better).
12-03-2024 07:40 AM - edited 12-03-2024 07:41 AM
@crossrulz wrote:
@rolfk wrote:
Use of Request Deallocation is extremely seldom useful (my guess is it’s below 0.01%). Outside of this rare unicorn case it is at best making the work of the LabVIEW compiler a lot more difficult, and always a performance nightmare!
In my 20 years of LabVIEW experience, I have successfully used Request Deallocation once. Even then, I'm not completely sure I was using it correctly (it was ~15 years ago and I don't have access to the code to see if I could handle the data better).
I never used it beyond doing some experiments and never saw a program where it was used in a useful way. When I saw it it was always to "fix" poor programming practices like race conditions caused by globals being accessed concurrently. Except that those "fixes" often started misbehaving after doing seemingly unrelated edits or updating the software to a newer LabVIEW version.
12-03-2024 08:19 AM
@rolfk wrote:
@crossrulz wrote:
@rolfk wrote:
Use of Request Deallocation is extremely seldom useful (my guess is it’s below 0.01%). Outside of this rare unicorn case it is at best making the work of the LabVIEW compiler a lot more difficult, and always a performance nightmare!
In my 20 years of LabVIEW experience, I have successfully used Request Deallocation once. Even then, I'm not completely sure I was using it correctly (it was ~15 years ago and I don't have access to the code to see if I could handle the data better).
I never used it beyond doing some experiments and never saw a program where it was used in a useful way. When I saw it it was always to "fix" poor programming practices like race conditions caused by globals being accessed concurrently. Except that those "fixes" often started misbehaving after doing seemingly unrelated edits or updating the software to a newer LabVIEW version.
My exact scenario was due to a VI needing to analyze a very large data set and we wanted to clear that out when the analysis was complete. Again, I may have been able to do better with tricks I have learned over the years.