NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Break on Step Failure

Does break on step failure suspends the execution of the threads also?

I launched one thread (T1) from main sequence. I also have another sequence file called in the main sequence as sequece call which launches another thread (T2). After T1 and T2 are launched a step in the main sequence failed. It appears that while the control is waiting on failed step it suspended the execution of the threads also, is this the expected behavior of Break on step failure?

*************************************************
CLD
*************************************************
0 Kudos
Message 1 of 5
(3,334 Views)

Yes, in order for a break event to occur (for any reason, not just break on failure), all threads within an execution must be suspended (or marked as externally suspended inside of a code module using the Thread.ExternallySuspended API). This is similar to how, when you are debugging a process with visual studio, all threads within that process are suspended when you hit a breakpoint. If you don't want this behavior, you should consider using the "New Execution" option on the sequence calls rather than "New Thread".

 

Hope this helps,

-Doug

Message 2 of 5
(3,333 Views)

Thanks Doug, I got some success but when using New Execution but I keep getting Microsoft R6025 - virtual function error and Object leaks. 

The attached sequence files can be used to replicate the issue.

Steps to replicate:

1. Create a StationGlobals "Program_End" as boolean.

2. Create a StationGlobals "DiodeThread" as object reference.

3. Under Edit>>SequenceFileProperties I have "Separate File Globals for each execution" set

4. Run in Single pass

5. Close TestStand and Microsoft R6025 - virtual function error is reported followed by Object leak or Microsoft Kill TestStand window.

 

Now if the subsequence call NewExecution2 is commented then after executing and closing teststand Microsoft run time error is not reported. The Wait for execution will return error but I am not sure how to check is object reference does not exist and skip the Wait function pragmatically.


Just to summarize the error seems to be reporting when I have:

Main sequence file (new execution example4-1.seq) call another sequence file(NewSequenceFile.seq) which calls another sequence file(NewExecutionTwo.seq) and runs this (NewExecutionTwo.seq) sequence file as New Execution.

 

I am uing TS4.1.

*************************************************
CLD
*************************************************
Download All
0 Kudos
Message 3 of 5
(3,318 Views)
Haven't had a chance to look at the sequences yet, but are you add/removing globals in one thread while accessing them in parallel in another thread? If so that could be the source of your problem. Setting and getting values on properties in teststand is threadsafe automatically, but structural changes (i. e. adding and removing properties) is not. I recommend creating all properties under globals that you will need in your first thread before any other thread is launched, or you will need to use a lock whenever accessing or modifying the globals. Another alternative is to pass parameters by reference to new executions and communicate between them that way.

Hope this helps,
-Doug
Message 4 of 5
(3,316 Views)

Thanks for the reply Doug,
Could you please explain further on " I recommend creating all properties under globals that you will need in your first thread before any other thread is launched, or you will need to use a lock whenever accessing or modifying the globals. "

Not sure what is meant by "creating all properties under globals"

 

Here is what I am doing:

1. I define the StationGlobals as object reference type in the StationGlobals.ini file.
2. Main sequence file calls another sequence file which then has a subsequence step call set to new execution. In the advance setting of execution the stationglobal object reference is used.
3. Lastly in the main sequence file the Wait on execution step is using the stationglobal.

I tried placing a lock around Wait on execution step but that still seems to be generating object leaks. In other words not sure where the lock can be placed.

Thanks again for your suggestion.

*************************************************
CLD
*************************************************
0 Kudos
Message 5 of 5
(3,299 Views)