LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SURE FIRE WAY of KILLING (STOPPING) a LabVIEW-based EXE APPLICATION

Solved!
Go to solution
Solution
Accepted by topic author Anthony_L

OK, the LabVIEW application was too detailed (large) to post. 

 

This one had multiple running parallel loops, plus: user events, queues, notifiers, semaphores, etc. 

Eventually, I did all of the following to make the app FINALLY EXIT:

Here are the six (6) code snippets that I had to use.  In my case, all of them were applicable to the LabVIEW application in question.

 

Exit Check List.jpg

0 Kudos
Message 11 of 19
(664 Views)

Did you figure out what exactly was causing your program ti not exit cleanly?

 

Because IMHO all of those things except for #6 should always be done. (Ignoring stopping parallel loops with a local or global is questionable in a large application)  

 

Personally I am a fan of the Channeled Message Handler. Every parallel loop has an "Exit" state except for my GUI that uses a User Event. My main control loop can send an "Exit" command to all of them to stop each loop, then waits for an ACK from each one that the Exit state has run and quits.

========================
=== Engineer Ambiguously ===
========================
Message 12 of 19
(622 Views)

Surely: it was the QUEUE and NOTIFIERS. Some had 20 sec wait times.

 
On exiting, processes stopped running so queues were just waiting. 

The GLOBAL exit is a no re. It just emphasizes the need for ONE GLOBAL EXIT variable. 

Because sometimes there is a tendency to use local EXIT variables for some loops in subVIs. 

0 Kudos
Message 13 of 19
(617 Views)

@RTSLVU wrote:

Did you figure out what exactly was causing your program ti not exit cleanly?

 

Because IMHO all of those things except for #6 should always be done. (Ignoring stopping parallel loops with a local or global is questionable in a large application)  

 

Personally I am a fan of the Channeled Message Handler. Every parallel loop has an "Exit" state except for my GUI that uses a User Event. My main control loop can send an "Exit" command to all of them to stop each loop, then waits for an ACK from each one that the Exit state has run and quits.


+1 for always keeping track of and closing all references.

 

NIquist_0-1707235845427.png

My usual technique to stop parallel loops is to use a main queue or notifier and monitor its status in slave loops.  Then when I close that reference in the EXIT state of the main loop, the Get Status VIs throw errors and end all the slave loops.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 14 of 19
(602 Views)

@Anthony_L wrote:

I think that there should be a way of THROWING some sort of GRENADE to make the F**ing LV app STOP RUNNING!!!

 


SystemExec Taskkill [yourprogram]

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 15 of 19
(593 Views)

@Anthony_L wrote:

Surely: it was the QUEUE and NOTIFIERS. Some had 20 sec wait times.

 
On exiting, processes stopped running so queues were just waiting. 

The GLOBAL exit is a no re. It just emphasizes the need for ONE GLOBAL EXIT variable. 

Because sometimes there is a tendency to use local EXIT variables for some loops in subVIs. 


So you don't send a message to the queues telling them to exit gracefully?

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.
0 Kudos
Message 16 of 19
(583 Views)

Hey:

 

It was not ignored. 

 

That concept can NEVER be ignored. I just added other things ontop of that. And made sure that a UNIVERSAL EXIT GLOBAL was in place and is seen by all subVI loops.

 

Not just local variable STOP booleans.

0 Kudos
Message 17 of 19
(577 Views)

So is this an academic discussion or are you really having issues with LabVIEW not exiting?  If it's the latter, I think it's a better use of your time to figure out why your code isn't exiting instead of trying to figure out a way to kill it.  It is highly likely that it's something you're doing and not something LabVIEW is doing.  Once you figure it out, you won't need to nuke your app.

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.
0 Kudos
Message 18 of 19
(551 Views)

Already solved by self. 

 

Took me couple of days to figure out the solution.

 

Please see response marked as a solution.

 

I was working in a group of developers back in the days of LabVIEW 2009 and we experienced similar challenges. Now I know why!

 

Its a likely challenge in large apps with multiple parallel loops, notifiers, semaphores, user events, and queues. Which was the case for this app.

 

Anthony

Message 19 of 19
(548 Views)