NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Teststand RunState.Engine.TerminateAll()

Solved!
Go to solution

Hello

 

I have a sequence file in Teststand 2019 using the batch process model running a burnin test system.

 

When i start the sequence file, first the ventilation is check in the sub sequence "Start Burin" (see picture in the attachment).

This Start Burin sequence run "One thread only". When the ventilation runs fine every thing is good, but when this sequence detects an error in the ventilation it make a fileglobal true (like FileGlobals.IsBurninFailing == True). 

When this happens the burnin has to stop immediately. This is done in the next step "Instantly stop"  by executing RunState.Engine.TerminateAll().

 

When i simulate a ventilation error, 6 out of 10 times everything works fine and all 7 threads are terminated, but 4 out of 10 times it doesn't work. I get a message saying "You have incompleet executions. Do you want to continue shutdown". I have to kill all threads eventually to stop the burnin.

 

Is RunState.Engine.TerminateAll() the best way to kill all threads immediatly ?

If not what is the best solution in stead of RunState.Engine.TerminateAll() ?

 

 

 

 

0 Kudos
Message 1 of 5
(2,025 Views)
  1. Terminating will not "kill all threads immediately". It will perform termination, which means all cleanups will be run. If you want to "Instantly stop" you need to call abort. Killing is not recommended since it can leave TestStand in an unreliable state. What is more, I don't know if there is a method to kill thread programmatically. I only know that you can change the time limit when aborting and kind of force kill when aborting.
  2. I'm not sure if you are asking for best practices for termination or if you ask for help with your inconsistent behavior.
    1. If you need a hint for termination then calling TerminateAll() is IMHO a good idea in such a situation.
    2. If you need help with inconsistent behavior then I would check the scope of FileGlobals. Make sure you have set the option to share globals between executions in batch. Also, if you have time-consuming calls to code modules, the termination will not be notified inside of them unless you use a Termination Monitor.

 

 

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
Message 2 of 5
(1,988 Views)
Solution
Accepted by topic author Tonnie

Hello Michal

 

I hope i found the problem that i have stopping all threads in case of te ventialtion error.

 

I used a Statement step which called RunState.Engine.TerminateAll(). This approche gave me the 4 out of 10 errors that i mentioned in my previous mail.

Now i have replaced the step type with a Action step type and a Active X/COM adapter (see picture ).

In this steptype i call TerminateAll(). I tested this approche 20 time with no failures.

 

So probably there is a difference between calling  RunState.Engine.TerminateAll() in a Statement step and in a Action step with a  ActiveX/COM adapter.

 

 

 

Tonnie_0-1647250633529.png

 

0 Kudos
Message 3 of 5
(1,967 Views)

There should be no difference between Statement and ActiveX action. If there is, it should be reported to NI as a bug.

 

I recommend performing more trials since normally there is no difference between those two approaches.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
Message 4 of 5
(1,961 Views)
Solution
Accepted by topic author Tonnie

Hello Michal

 

Next Thursday i will perform more test to be sure that the action step with  ActiveX/COM is the solution.

 

Thanks for you help

 

 

0 Kudos
Message 5 of 5
(1,941 Views)