Jump to content

Recommended Posts

I am staring at this:

266135766_StrangeVIStatus.png.33b8e5c0d1ad8533fd28b695b0a7b336.png

which shows a snapshot of 3 VIs, two of them being in vi.lib/Utility/error.lib VIs (visible FP), the other one being a subVI in a library of mine.

The snapshot illustrates the puzzling situation that I am encountering: Three Button Dialog.vi, whose state is idle as is clear from the snapshot (but is also confirmed by the LabVIEW Task Manager), is however "running" as indicated by the green arrow in the calling VI (whose BD is shown in the back).

The "Close Notebook Dialog Window" is nothing but the Three Button Dialog CORE.vi of the error.lib library, and is also idle.

In other words, the calling subVI is never stepping out of this situation and the only way for me to recover is to abort the VI.

Question: how is THIS even possible?

Background information:

First of all, I wished I could boil this down to a simple example that I could share, but I haven't been able to reproduce this yet in a bare bone project.

Now, the weird thing is that this situation occurred after what I thought would be a simple refactoring of my application, namely dynamically launching my consumer loop, which itself launches the Notebook VI whose subVI is now unresponsive.

Before:

Main launches Notebook dynamically.

User closes Main. Only Notebook remains live.

User clicks Notebook's "close box" which call the  3-button dialog.

User clicks "No", Notebook closes.

After:

Main launches Consumer loop VI dynamically.

Consumer opens Notebook dynamically.

User closes Main which sends a "Quit" message to the Consumer loop, shutting it down. Only Notebook remains live.

User clicks Notebook's "close box" which call the  3-button dialog

3-button dialog is idle, Notebook is stuck waiting for it to finish.

 

Something is going on (or rather is not). What could it be?

 

LabVIEW 2021 SP1 64-bit Windows 10

 

Edit: I forgot to mention that none of the VIs above are re-entrant and that the 3-button dialog CORE.vi is supposed to run as a modal window.

Edited by X___
added note on VI properties
Link to comment

I don't fully understand your post. Does the problem also occur if you don't have the front panel of "Three Button Dialog.vi" oneped? Does it occur if only the caller vi is open? I often make dialogs from a "promt user input" express vi by opening it's front panel thus converting it. If I forget to close its front panel, all sorts of similar race condition things occur if I run the main vi. Never cared enough to have this sorted out though...

Edited by Lipko
Link to comment
6 hours ago, ShaunR said:

Those dialogues (one, two and three button) run in the root loop. If there is a race condition, LabVIEW is screwed. Never use them. Spend two minutes to make your own dialogue.

I had to read this to learn something new (about bugs and wasps): http://www.labviewcraftsmen.com/blog/the-root-loop

However that post says that the 3-button dialog (which I am using) does not require to run in the root loop...

I generally write my own dialogs, but this one is convenient (although style-wise, pretty dated) because of all its fancy formatting. I'll try with my own regardless, just for verification purpose.

Link to comment
2 hours ago, Lipko said:

I don't fully understand your post. Does the problem also occur if you don't have the front panel of "Three Button Dialog.vi" oneped? Does it occur if only the caller vi is open? I often make dialogs from a "promt user input" express vi by opening it's front panel thus converting it. If I forget to close its front panel, all sorts of similar race condition things occur if I run the main vi. Never cared enough to have this sorted out though...

I am discussing run time behavior. I am not editing the 3-dialog button VI. The snapshot I showed is the end result of the app running (and getting stuck).

The FP of that dialog window opens up via an invoke node in that dialog VI (the first part is formatting, as I mentioned in the previous post - the VI can be checked in vi.lib), and then there is a simple event loop that waits for a button click, which ends the execution and closes the VI. So when that dialog VI is reached in my Notebook VI (at the green arrow location in the original post), the dialog VI executes, formats itself, opens its window, and by some magic, quits the event loop without a click and doesn't close the window.

I have put error indicators in that 3-dialog CORE VI to check whether any error was generated, but couldn't see any, which makes that (putative) behavior so puzzling to me.

Link to comment
1 hour ago, ShaunR said:

'There's your answer. BTW. If you try to debug it, it works fine :ph34r:

Still don't get how this is my answer, in particular to the "running VI arrow" in the calling VI and the stopped CORE.vi question. I think I do remember indeed that putting a breakpoint in the CORE.vi and stepping through it might have prevented it from "aborting" (for lack of a better understanding of what is happening), but then, when that CORE.vi is/was called from within the main VI, things were working fine, so it doesn't really explain anything for me.

But to some extent, this doesn't matter anymore at this point.

Link to comment

By any chance, is your main VI launched in a different application context (i.e. from the tools menu or custom context)?

Here is an example where the dialog is called from the tools menu (top) while the front panel is open in standard context (bottom).

image.png.4510b34e200aabcb7016da1c2f821ed2.png

Link to comment
7 hours ago, LogMAN said:

By any chance, is your main VI launched in a different application context (i.e. from the tools menu or custom context)?

Here is an example where the dialog is called from the tools menu (top) while the front panel is open in standard context (bottom).

image.png.4510b34e200aabcb7016da1c2f821ed2.png

Nope. The CORE.vi was called by the 3-buttons dialog VI (the "white" version of the CORE.vi, i.e. a wrapper to the CORE.vi), itself called from a dynamically launched VI.

As I said, a pared down test version of the program was working just fine (which is why I was not able to post such an example).

I guess I must be getting old, as I have decided to move on without fully understanding what was going on, having solved this issue with a custom dialog VI.

This being said, if someone can recreate a situation such as illustrated in my original post (a non-reentrant stopped VI whose icon in a calling (stuck) subVI being debugged shows the "green" arrow), maybe we'll get closer to figuring out what was going on (no need to focus on the CORE.vi).

Link to comment

It turns out that this was a classic case of a spawned VI and orphaned references (and after all, swapping my VI for the 3-button dialog did not change the pattern, although it improved the look), even though I am not quite sure this all makes sense to me...

But anyway, the bottom line is that I managed to circumvent the problem by keeping some references alive in a hidden launcher VI which shuts down when no more windows are left open.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.