LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What happens when you press 'Abort Execution'

Hi,

   I have written an application, it takes about 4 hours to run. Everything is fine with it, (it seems) but if you press the 'abort' button, then LabVIEW hangs and eventually crashes. I think that the longer the application runs before I hit abort the more likely it is to crash, but I could be imagining that bit. Are there some specific task that LabVIEW performs when abort is hit? Cleaning up the sessions, closing ports, etc... that the porgramming of my application may affect. If so, does anyone know how to track down the offending programming technique I am using?

Many thanks, Alec

 

(BTW, the I/O in this application is an RTU Modbus Device, a serial 232 device and a Compact DAQ chassis)

0 Kudos
Message 1 of 19
(6,042 Views)

The abort button (the entire toolbar!) should not be visible in a properly built application.

Message 2 of 19
(6,032 Views)

e abort button, my friend, will not be visible in the final application. But that is not a solution to the problem. My problem indicates an error in programming technique, and it is this problem I am attempting to address.

0 Kudos
Message 3 of 19
(6,027 Views)

There is probably nothing wrong with your program (at least regarding this specific issue ;)). Pressing abort while part of the code is executing inside a dll or communicating with an instrument etc. can give unpredictable results.

 

Maybe this old proverb can give you some ideas. 😄

Message 4 of 19
(6,018 Views)

All Heck can break loose when you hit that Abort button.  Drivers, files, references, etc are not properly closed out.  Execution is just randomly stopped.  Memory isn't cleared.  It is there for emergency purposes, which you are apparently running into.  I have not had LabVIEW crash due to the abort button.  But now that I'm thinking about it, it could be causing one of my coworkers to see a bunch of crashes.


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 5 of 19
(6,017 Views)

From using the Abort your can't tell anything about the programming technique.

Use the Abort Execution button is like stopping your car with the help of a tree. The car will stop, it will not be pretty, and it will not tell you anything about the performance of the car. Maybe a little about the cars ability to handle crashes. 

 

LabVIEW will not run any extra code after you hit that button, it will stop the run you are runing as fast as possible, without any cleanup. So if you are using some dll's, hardware or anything like that, you can't be sure what state they are left in.

 

For us to give you any feedback on your programming we need to details on the code.

The best way is the code itself, but sometimes that is not possible.

Message 6 of 19
(6,011 Views)

 

let me try to be very clear,, when you press the abort button, LabVIEW attempts to stop the VI immediately it even try to release whatever resources were reserved while the VI was running sometimes it cannot do so.

 

Why? Something external to LabVIEW is maintaining the resources and LabVIEW is trying to play nice with those other external things. This explains the old proverb Christian was referring to. Unless you complete the VI normally unexpected things may happen but the VI will stop operating.

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 19
(5,977 Views)

Hi, I am facing similar problem (only that LabView does not crash). I want to be able to clear any memory and close any handles as well as running VIs upon clicking the abort button.

 

It can be immensely helpful as I won't have the need to close LabView every time I do that.

 

In my case LabView opens sockets which remain open after I click on the abort button. so I would like that not to happen or at least be able to perform some kind of cleanup.

 

Is there an even that is fired/triggered when abort button is clicked? If there is one, it might be possible to capture that event in an external dll maybe and perform cleanup manually? Can LabView support/admins shed some light on it please?

 

Thanks

0 Kudos
Message 8 of 19
(5,273 Views)

As the others said, 3 years ago, don't use the abort button to stop your program! Write your program to have a "stop" button that appropriately closed resources, etc. The abort is like hitting the power button on a computer, it stops the execution, but frequently with dire consequences. Look at the various architecture examples and pick one that will work best in your instance, then have a planned "Exit" state that closes all the references, sockets, etc. Abort won't do that. 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 9 of 19
(5,270 Views)

What I do is use the Event Structure with a "Panel Close?" filter event.  This way, when you try to close the window, this event will be called.  Since it is a filter event, you can "discard" the closing and proceed to close everything out before letting your VI run to completion (ie all loops have completed and any additional code after said loops are done running).  More commonly, people will have a stop button and use the Value Change event to stop their code in a similar manner.


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 10 of 19
(5,259 Views)