Showing results for 
Search instead for 
Did you mean: 

'Application Instance Close' not triggered during PXI shutdown


I have a headless application that runs at startup on a NI PXIe-8133.  My hope was to cleanly close the application when the user restarts the PXI either through MAX or by physically powering down the PXI.  I thought the 'Application Instance Close' would be triggered in these cases, but it doesn't look like it is triggered in either case.  Is the 'Application Instance Close' meant more for closing an application through a UI?  Is what I'm trying to do possible?

0 Kudos
Message 1 of 6

The application instance close event is triggered when your software is told to exit by the operating system. 


 Is your PXI chassis running Linux RT?  There isn't much documentation about the behavior of this in a real time operating environment so I would question if it's designed for that case.  Are you trying to make sure your software accomplishes a clean shutdown upon reboot?  That's generally what this event case is used for and it can be accomplished other ways if so.  Let me know if that is helpful.


Best Regards, 



0 Kudos
Message 2 of 6

The PXI is running NI Real-Time Phar Lap ETS 13.1.


The reason I want to cleanly shutdown is that there is another application (not made by me) that is polling the state of hardware IO over DAQmx, and once they start a shutdown the DAQmx calls start throwing errors (I'm assuming when the driver is deinitialized) and causes a lot of log spam.  Would like to also capture the shutdown event and close the connections to the hardware.


Was hoping the Application Instance Close event would capture this, but maybe the OS doesn't stop the application before shutting down.  This seems to echo what this thread is saying.

0 Kudos
Message 3 of 6

Could you use the DAQmx errors to execute a shutdown event?  

0 Kudos
Message 4 of 6

Hey mbremer,


There is not an inherent way of programmatically shutting your system down within LabVIEW and this is done intentionally. The ability to entirely shutdown your system is controlled by a mechanical switch so that Real-Time systems that are running remotely don't remain shutdown which would require the user to have to physically travel to the system and flip a switch to turn it back on. However, there are ways to save your data and restart your system which can be found in the following KB. 


Reboot LabVIEW Real-Time Controller Itself Programmatically


Best regards,

Trent Fields

Applications Engineer

0 Kudos
Message 5 of 6


I could, but I don't think I can guarantee the errors will happen every time at shutdown or that they wouldn't happen during regular use.  I think we going to move away from requiring the user to restart the PXI to reset the application and build in a reset command that cleans up the IO.  We did the former to simplify the software, but it turns out it's costing our customer a lot of time (rebooting the PXI can sometimes take several minutes).



I don't want to shutdown the PXI programmatically, but just want to capture when the user powers down the device (using the physical button or through MAX).  On desktop this is done through the Application Instance Close event, where there's a chance to perform some cleanup before the application is stopped.  on PXI it seems this event is not triggered in the cases I mentioned above.



0 Kudos
Message 6 of 6