NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Incomplete Executions (LoginLogout)

Hi,
I do not know what caused the behaviour, but I started to get the attached error message while closing TestStand.
It happens only if I execute a sequence.
If I just edit the sequence or do nothing (just open and close), it is OK.
 
Actually weird behavior start before closing.
After the execution ends, the keyboard shortcuts like Ctrl+M (Specify Module) and even mouse double-clicks on steps fail to operate.
The "incomplete execution" message does not make sense to me because I see my execution completing.
 
I checked the FrontEndCallbacks.seq file. There are only 2 steps in it: Login and Logout.
I think it is Logout step that complains about incomplete executions.
 
Can anybody figure out what is wrong with my TestStand?
Regards,
S. Eren BALCI
IMESTEK
0 Kudos
Message 1 of 11
(4,247 Views)
Hi,
 
What version of TestStand are you using?
Is this behaviour with the Sequence Editor or the Operator Interface or both?
If the Operator Interface, are you using the default OI or a custom version?
If a custom version, does the behaviour occur with the default version?
 
Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 2 of 11
(4,239 Views)

Hello Ray,

Thanks for responding.
I have version 3.5 (pardon me for not specifying it in the post).
I see the behaviour in both seq. editor and default OI, and also when I attach the CVI DLL project to TS for debugging and run it from CVI.

Nothing is custom.
I do not have custom callback, custom step types, etc. I have code written in CVI and compiled as DLL.

I tried the following: break at the first step of the Setup group of the MainSequence, terminate execution, close TestStand. So no step is executed at all. Only my DLL is loaded.
In this case when I click close, I see the DLL unloading (its UI panel get discarded) but the TS window stay as it is. If I click 'X' on the sequence window (not TS) I get the attached message. If I try to close the TS again the panel I attached in the first post appears.

The behavior is really depends on if I use the TS window close button, sequence windows close button or right-click the toolbar button and click Close. In the latter case, for SeqEdit, another message says: System Level Exception -17502

In all these cases (also for the ones mentioned in the first post) TestStand does not close normally.
I have to use End Task from Task Manager.
The 'Incomplete Execution' panel does not dissappear if I use "Terminate all" or "Abort all" on the panel.

note 1: Excuse me for erasing the name of my sequence file from the picture.
note 2: I tried an example sequence from tutorial and nothing went wrong. TS closes normally.

Message Edited by ebalci on 06-04-2007 10:42 AM

Message Edited by ebalci on 06-04-2007 10:54 AM

S. Eren BALCI
IMESTEK
0 Kudos
Message 3 of 11
(4,238 Views)

Hi,

Sorry for the delayed response.

[I tried the following: break at the first step of the Setup group of the MainSequence, terminate execution, close TestStand. So no step is executed at all. Only my DLL is loaded.
In this case when I click close, I see the DLL unloading (its UI panel get discarded) but the TS window stay as it is. If I click 'X' on the sequence window (not TS) I get the attached message. If I try to close the TS again the panel I attached in the first post appears.]

I'm trying to get a picture from your statement above of what's happening. These different windows is painting a confused picture. I'm not sure whether you are in the SeqEditor or the Operator Interface.

When you say close TestStand, why is your DLL still loaded?

Sequence window, does this refer to the Operator Interface?

What does TS refer too?

[In all these cases (also for the ones mentioned in the first post) TestStand does not close normally.
I have to use End Task from Task Manager.
The 'Incomplete Execution' panel does not dissappear if I use "Terminate all" or "Abort all" on the panel.]

This seems to suggest that in your DLL you are starting a new execution, which you are not closing properly or are not releasing the references to the new executions unless you use Terminate All or Abort All.

Can you say what you DLL is doing?

Regards

Ray Farmer

 

Regards
Ray Farmer
0 Kudos
Message 4 of 11
(4,209 Views)
Hello again Ray,
Sorry for the confusing description, it is because the situation was confusing for me, too Smiley Indifferent
First of all, I use TS as a shorthand for TestStand.
 
Now, I have tracked the problem to my DLL detach code.
During DLL attach I create a thread pool of 3 threads and I discard it during DLL detach. But it takes forever for CmtDiscardThreadPool to return.

That's why my execution is not finished when I thought it was. I could not understand what is going on with CmtDiscardThreadPool.
So while CVI is waiting for it to return TS waiting for the DLL to detach and when I try to close it warns me there are incomplete executions.
 
There is one more thing I could not understand:
From the sequence file properties I set the load/unload options as "preload when execution begins" and "unload after sequence executes" .
That options are supposed to override the step option, right?
 
However, when I debug the application the DLL detach code (in DllMain) is called only if I use the menu option "Unload all modules", not directly after the last step in cleanup executes.
 
If I (or one of you guys) can find answer for these 2 questions my problem is solved Smiley Happy

Message Edited by ebalci on 06-07-2007 05:22 PM

S. Eren BALCI
IMESTEK
0 Kudos
Message 5 of 11
(4,182 Views)
Hi S. Eren BALCI,

From the CVI help topic on CmtDiscardThreadPool:
CmtDiscardThreadPool waits for all currently executing thread pool threads to finish before destroying them. If your Thread Functions are not guaranteed to finish executing, you must make sure that no active threads exist in the pool before calling this function. Call CmtGetThreadPoolAttribute with the ATTR_TP_NUM_ACTIVE_THREADS attribute to determine the number of active threads in the pool.

Does this case apply to your DLL?

In regards to unloading modules, yes, the sequence file properties override the step properties unless you select "Use step unload option". What happens if you select "Unload after step executes" or "Use step unload option" and change the step unload option to "Unload after step executes"?

Regards,
0 Kudos
Message 6 of 11
(4,140 Views)
Hİ James,
Thanks for the reply.
 
I was using just a single thread from the pool and I am sure it is finished.
That thread is actually a loop controlled by a flag. I reset the flag in the detach code so that the loop terminates.
After I reset the flag I wait for the thread function to finish using CmtWaitForThreadPoolFunctionCompletion.
A panel is loaded and displayed in this thread. I also see the panel being discarded as a second clue.
 
I somehow overcome the problem by using the default pool instead of a pool I created.
Altough the problem is gone now since I do not need to discard the default thread pool, I am not happy since the main problem is still in there.
 
For the second problem;
I call the DLL from many steps, not just a single step. Initially, I did not know that there is a global setting for load/unload and I manually set all unload options to "unload after sequence executes". In the initial phases of development it was OK (when execution ended the DLL got unloaded). Now, even the global setting cannot make my detach code get called.
 
I know it is hard to help such a case from outside. At least it does not keep me from going on to my project, for now.
Thanks very much.
S. Eren BALCI
IMESTEK
0 Kudos
Message 7 of 11
(4,127 Views)
Hi S. Eren BALCI,

What happens if you make a sequence with just one step that calls your DLL and you select "Unload after step executes"?

Regards,
0 Kudos
Message 8 of 11
(4,107 Views)
Hi James,
 
Thanks for continuing support!
I tried your suggestion and DLL get unloaded.
I cloned my whole sequence file for trial-error stuff and ran some "experiments" on the backup copy. Here are the outcomes:
 
- At the end of the execution with the new (backup) file, DLL did not unload as well.
 
- I have like 16-17 sequences in the file. If I delete some sequences from the file (at the end of execution) suddenly DLL unloads (I can tell because my panel disappears). But deleting some other sequences have no effect.
 
- I investigated further: The sequences that deleting has no effect on unloading are the "dummy" ones. I mean the ones that have steps in them but call no module or etc. I put them there just to visualize a test flow in advance.
 
- For the DLL to unload I have to delete all "functional" sequences, which has steps that call modules (including the DLL that I am coding) etc.
 
- Besides, with all sequences in place (dummies and functionals), if I change the global load option (not unload option) to "load dynamically" then DLL gets unloaded at the end of execution!!!
 
- I am afraid I might be celebrating an early victory, because for the trials to be quick I quit the execution as early as possible. So not all steps get executed when I press the QUIT button on my UI. So the problematic step did not load its associated module yet when I quit.
 
Do these results ring a bell? Smiley Happy

Message Edited by ebalci on 06-14-2007 10:52 AM

S. Eren BALCI
IMESTEK
0 Kudos
Message 9 of 11
(4,098 Views)
Hi S. Eren BALCI,

When you press the quit button do you mean that the sequence immediately aborts without terminating (calling clean up)?

Regards,
0 Kudos
Message 10 of 11
(4,078 Views)