LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV silent crash with threading and oop on LV2009 f2

Solved!
Go to solution

RogerI wrote:

I vote for a full blown LV RefOOP toolbox starting with:

 

- mutex support

- threading support with a thread pool for easy access to each thread when probing

- interfaces support

 

 🙂

 

/Roger

 


 

Smiley Surprised 

 

As an old-time hardware guy I vote for...

 

Someone explaining what all of those terms mean.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 21 of 38
(1,556 Views)

I think this is exactly the problem leading to unmaintainable LV code. 

 

Software engineers shunning away from LV due to lack of proper oop mechanisms available in other languages.

 

Which leaves electrical engineers and gui-klickers to create unmaintainable LV spaghetti with locals, globals and stacked sequences, not to mention extremely large diagram single vi-programs.

 

/Roger

 

0 Kudos
Message 22 of 38
(1,541 Views)

I just got an update. It looks like a CAR will be filled but they aren't ready yet.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 23 of 38
(1,537 Views)

Hello,

 

This was reported to R&D (# 199299) for further investigation.  When looking through your code, I noticed that if I removed the type cast in the writeUnlock vi, the program would no longer crash.  We still need to do more research on this issue to figure out what exactly is happening, but I agree with Ben that this issue is likely related to type casting.

Message 24 of 38
(1,515 Views)

Burt, I think you mean "bundle by name" in writeUnLock.vi?

 

If you remove the bundle by name and leave everything as it is, then it will not crash!

 

Regards,

 

/Roger

 

0 Kudos
Message 25 of 38
(1,504 Views)

Hello Roger,

 

I don't see a Bundle by Name in the writeUnLock VI.  I did see one in the lockChild method which I believe also prevents the crash.   However, if you prevent the type casting of the class in the writeUnlock method in the Thread1 class, the crash should stop happening.  Unfortunately I still don't know what is causing this issue, but the issue has been sent to R&D for investigation.

 

Message 26 of 38
(1,485 Views)

Burt, you are right! My mistake.

 

The type cast is essential in this approach.

 

Do you know if there is any LV reference based oop in progress at NI? 

 

Have a great weekend!

 

/Roger

 

0 Kudos
Message 27 of 38
(1,474 Views)

CAR solved. Yes -- it's a bug in LabVIEW. The bug is in ExecutionBase.lvclass:ExecutionBase_Create.vi.

 

 Here's the fixed up VI (I included both the image, which highlights the workaround, and the VI, saved in LV 2009). 

 

The problem is your attempt to stick an object inside itself. LV normally catches that and should've made a copy of the object... still not sure why that's not happening in this particular case, but it isn't. We'll get that fixed for LV 2010. 

Message Edited by Aristos Queue on 12-16-2009 06:20 PM
Download All
Message 28 of 38
(1,402 Views)

RogerI wrote: 

 

Do you know if there is any LV reference based oop in progress at NI?

 


For the record, I'm the lead architect for all the OO features of LV. The Data Value References released in LV2009 are our solution for references and will be the full extent of reference support you should expect in LabVIEW. The DVRs solve the dining philosophers problem that single-element queues were succeptible to when multiple of them were used in conjunction, they provide init and uninit bottlenecks for LV classes, and they can help control data copies. Various requests for extension of the feature have been heard and generally rejected for the next several years. The most common request is the wiring of DVRs of classes directly to subVI terminals meant to accept class wires directly... "Why do I have to wrap my subVI calls in an Inplace Element Structure every time I want to access the reference?" The answer is two fold: Primarily having the user explicitly control the length of time that the reference is unlocked (via the structure) encourages the design of APIs that avoids race conditions when multiple operations need to be done in sequence without parallel operations intervening (such as setting multiple properties in the object). Secondarily, there are some situations where a node has multiple output terminals of the class type where it would be ambiguous which one should be the one put back in the reference. The secondary case is far far less important than the primary. If you want to design a class that is meant to be used by reference, that's straightforward... just implement all the methods as operations that take the reference and use Inplace Elt Struct on their diagrams. Include protected-scope dynamic dispatch methods for things that you want child classes to override.

 

If all of this seems "not exactly easy to use", that's intentional. In a highly parallel language such as LabVIEW, references are extremely dangerous, leading to a whole host of hard-to-debug bugs.  Reference classes should be used very rarely -- I'm sticking by my estimate of no more than 5% of all classes out in the world should be by reference, and most users shouldn't be needing them at all. In the vast majority of customer apps that I have looked at -- and I get called in to review many of them -- the code can be completely rewritten without references to the classes, resulting in fewer bugs and much higher performance. The higher performance comes because a) you get rid of the mutex overhead and the cache-line hits of the references and b) the LV compiler can do optimizations with by value types that cannot ever be applied to references.

 

I personally do not see the low levels of support for references as a drawback for LabVIEW. Rather, we are one of the few languages that can really take advantage of the multicore environment that most computers are becomming, and as time goes by, I expect more and more algorithms previously written to use references to change to not use them so that they can be made more parallel, and spending our time improving and optimizing the by-value cases is much more important to the future growth and adoption of LabVIEW.

Having said that, we do listen to our customers, a lot, and if after a couple years we see that there really is a need for more reference support than the DVRs supply, we'll add them. At the moment, we think we've got the right levels (baring bugs like the one you found). I hope the OO features we have today have improved your LV experience and helped your programming. Please keep providing feedback and we'll keep doing our best to make it better as time goes by. 
Message 29 of 38
(1,397 Views)

Aristos Queue wrote:

RogerI wrote: 

 

Do you know if there is any LV reference based oop in progress at NI?

 


For the record, I'm the lead architect for all the OO features of LV....


Having said that, we do listen to our customers, a lot, and if after a couple years we see that there really is a need for more reference support than the DVRs supply, we'll add them. At the moment, we think we've got the right levels (baring bugs like the one you found). I hope the OO features we have today have improved your LV experience and helped your programming. Please keep providing feedback and we'll keep doing our best to make it better as time goes by. 


and quoting myself from post #13

 

"The good news is that Aristos Queue and his group take responciblity for "their baby" and act on them quickly, if appropriate."

 

Smiley Wink

 

Ben

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 30 of 38
(1,366 Views)