NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Reentrant VIs and number of handles

Hello,

 

I have a sequence running tests on 16 UUTs in parallel.  Each UUT is run in a separate execution.  The sequence communicates with each UUT using serial communication (1 serial port per UUT).  Therefore my communications VIs are set as reentrant to speed up tests.  The complete test sequence is executed in a loop (temperature cycling)

 

It works well with a few UUTs.  However, if I have 8 of more UUT, the system sometimes returns an out of memory exception.  I can't see any serious memory leak using Windows task manager.  However the numbers of handles related to Seqedit in increasing very fast and the system starts returning errors when the numbers of handles reaches 125k.

 

I started monitoring the number of handles for many different cases:

 

  1.  Comm VIs not reentrant.  The number of handles increases by 2000 for each UUT in test.  The total number is stable once each UUT has completed once its test sequence.

 

  2. Comm VIs reentrant:  The number of handles increases by 10000 for each UUT in test.  The total number is stable once each UUT has completed once its test sequence.  The 10k value is valid for both types of reentrant VIs.

 

 3. Set the Inlining option for the Comm VIs.  Same effect as setting them as reentrant.

 

Therefore running my 16 UUTs at the same time needs 160k handles and the application crashes arround 125k.

 

Is there anymway to set a VI reetrant between execution but not within an execution?  I was thinking of putting my Comm VIs (set as reentrant) inside a sequence and calling this as a subsequence rather than calling the VIs directly.  Will this reduces the number of instances of the comm VIs in memory?

 

In Windows, is there a way of increasing the number of handles for an application?

 

Regards,

 

Patrick

0 Kudos
Message 1 of 3
(3,322 Views)

You might very well have a leak issue somewhere in your code. It's odd that you would need anywhere near that many handles. Perhaps there are things in your VI that should be getting closed that aren't?

That said. One thing you might try, given the results you describe, that might reduce the handle usage is to create a separate copy of the VI per testsocket/UUT rather than making the VI Reentrant. That will allow each thread to have it's own non-reentrant VI so that each separate VI can run in parallel, but they don't have to be reentrant.

 

-Doug

0 Kudos
Message 2 of 3
(3,305 Views)

Howdy plessnick,

 

You can use VI server to change the Reentrancy of a VI dynamically. Here's an example.

 

http://digital.ni.com/public.nsf/allkb/BCE8D9E4CB4A6EC686257617006C209B

 

It's important to note that when you want to change the reentrancy the VI it has to be done when that VI is not loaded into memory.

In regards to your placing them in subsequences, I think it would have the same effect. Whether they are being in the main sequence, or a subsequence, we are still spawning the same number of instances of that VI into memory. I'm not sure how this would effect the process handles though.

 

As Doug mentioned, it does seem like a very large number of handles. I'm going to try and investigate if there are any other changes we can make, but checking to make sure we don't have any memory leaks due to unclosed references is always a good idea.

 

Tim A.
0 Kudos
Message 3 of 3
(3,295 Views)