LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you think of a scenario where the use of Request Deallocation could cause a race condition / stale data?

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.

0 Kudos
Message 1 of 8
(476 Views)

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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 8
(434 Views)

@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

0 Kudos
Message 3 of 8
(412 Views)

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.

Rolf Kalbermatter
My Blog
Message 4 of 8
(403 Views)

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.

Certified LabVIEW Architect
Message 5 of 8
(380 Views)

@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).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 8
(352 Views)

@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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 8
(344 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 8
(338 Views)