LabVIEW Main VI is Freezing/Hanging

Updated Aug 18, 2023

Reported In

Software

  • LabVIEW

Operating System

  • Windows

Issue Details

  • When I run my LabVIEW Main VI, it freezes, hangs, or holds unexpectedly. 
  • I suspect one of my LabVIEW subVIs is taking a long time to execute.

Solution

A possible cause of this issue consists of a particular subVI freezing the Main VI.
  1. Run the code using the Highlight execution
  2. After isolating the subVI in question, determine why the subVI does not continue its execution. This can be caused by and not exclusively:
    • The settings within VI Properties are causing the whole VI to be suspended when the subVI is called.
      1. Open the subVI. Then, select File>>VI Properties.
      2. Select Execution from the Category drop down list as seen below:
        EXECUTION.jfif
      3. Ensure that Suspend when called has not been checked and then press Ok.
        image
      4. Run your Main VI again to check if the issue has been resolved. 
    • while loop that without a defined conditional terminal. It is not recommended to have while loops within subVIs because they can cause the main VI to freeze inadvertently. However, if there is no other way to accomplish a certain task, Global Variables could be used to stop a while loop that is running within a subVI. The following code illustrates how this can be performed. The architecture of the Main VI consists of two while loops run in parallel. The first one is dedicated to updating the global variables, and the second one is dedicated to run the SubVI. The paradigm is inefficient, therefore should be used only when is strictly required.
      • Main VI:
         Main VI.jfif
      • SubVI:
        Sub VI.jfif             
    • Event structures that have been setup incorrectly. 
      • Make sure there are no event structures waiting for events.
      • Ensure event structures are placed in a loop in case events need to be detected multiple times. Otherwise, only the first control change will be registered by the event structure.
    • Functions waiting for an action indefinitely.
    • High amount of data being imported to subVIs by default. 
    • Driver corruption. For example, when VISA functions freeze the Main VI.
 
 
 

Additional Information