LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What happens to daqMX tasks when not properly closed?

I'm looking for a whie paper or something explaining what exactly happens to daqMX tasks when they are unexpectedly aborted.  Computer crashes, someone pushes the "Abort Execution" button, program is closed from task manager, etc.

 

I ask because I'm getting some unexpected behavior in this case, and I want to understand what is going on.

0 Kudos
Message 1 of 8
(3,548 Views)

They become disconnected virtual spirits doomed to roam the interwebz for all eternity.  Smiley Surprised  If you listen closely in the still of the night sometimes you can hear them wailing...

No wait, those are just COBOL programmers. Smiley Sad

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^{
Message 2 of 8
(3,531 Views)

@NIquist wrote:

They become disconnected virtual spirits doomed to roam the interwebz for all eternity.  Smiley Surprised  If you listen closely in the still of the night sometimes you can hear them wailing...

No wait, those are just COBOL programmers. Smiley Sad


While amusing, not exactly useful.... Smiley Indifferent

0 Kudos
Message 3 of 8
(3,512 Views)

Depends a bit. If the LabVIEW hierarchy in which they were created terminates normally (meaning the  top level VI goes idle) the task is automatically cleaned up by LabVIEW, just like with refnums. If you terminate the process brutally the daqMX DLL should clean them up as soon as it gets unloaded after the process died (either from a crash or process kill).

 

However, Windows may not always allow a DLL to execute its cleanup routine when the process loading that DLL was fatally terminated. Also certain things are not safe to do for a DLL during loading and unloading, as that could deadlock the Windows module loader.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 8
(3,492 Views)

In a test system I was developing, if we did not close out our DAQmx tasks, we would get a "resource not available" error.  The only way out of it was to shut down LabVIEW and TestStand.  That was a few years ago, so things may have changed.  But based on that experience, the tasks are still there, you just lost your reference to it.  Aren't memory leaks so much fun?


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 8
(3,475 Views)

@rolfk wrote:

Depends a bit. If the LabVIEW hierarchy in which they were created terminates normally (meaning the  top level VI goes idle) the task is automatically cleaned up by LabVIEW, just like with refnums. If you terminate the process brutally the daqMX DLL should clean them up as soon as it gets unloaded after the process died (either from a crash or process kill).

 

However, Windows may not always allow a DLL to execute its cleanup routine when the process loading that DLL was fatally terminated. Also certain things are not safe to do for a DLL during loading and unloading, as that could deadlock the Windows module loader.


I figured it had some automatic cleanup stuff.  What about the case where the computer locks / shuts down (someone comes by and unplugs it)?  We're talking specifically cDAQ.

0 Kudos
Message 6 of 8
(3,447 Views)

Edit (since a double post anyway)... I figured out the odd behavor I was seeing, but I think it is still important to understand exactly what is going on in the hardware.

0 Kudos
Message 7 of 8
(3,446 Views)

Aaa, well, cDAQ is a special beast! Since it has in fact its own intelligent controller onboard and needs to have some resource locking in order to prevent two clients trying to access the same resource at the same time over the network. So you have some special functions in the DAQmx API to try to claim and reserve the resource and then to release it again.

 

Look at DAQmx Reserve Network Device.vi and DAQmx Unreserve network Device.vi 

Rolf Kalbermatter
My Blog
Message 8 of 8
(3,433 Views)