NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Error Code -17400; Unable to create thread

Running TestStand 4.0.  Test sequence calls many sequences that run as new executions and runs fine for up to about 8 units testing simultaneously.  After that, I get a run-time error code -17400; Unable to create thread.  There are no other details available.  The steps that generate the error are able to create the new executions initially, but eventually fail once about 22 executions are running.  I am monitoring memory resources and there does not appear to be any issues.  Any troubleshooting suggestions?  Thanks.

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

Hi George,

 

I was able to place down 30 sequence calls which create new threads, and I did not receive an error when running the sequence. Would you be able to narrow down your sequence to an example that we could run without any hardware connected? Please post this here, and we'll see what we can find about it.

 

Thanks,

 

John M

National Instruments
Applications Engineer
0 Kudos
Message 2 of 5
(3,786 Views)

If you have accidently created sequences which create new threads and recursively call themselves to again create new threads, it's very easy to create a lot of threads very quickly and at some point the operating system will refuse to create additional threads. Try setting a breakpoint and stepping through your execution to see what is happening and look at the threads window to see how many threads are being created.

 

Hope this helps,

-Doug

0 Kudos
Message 3 of 5
(3,771 Views)

My test sequence has several test groups, each of which contain loops that create new threads (tests) for 48 UUTs.  Thus the number of running threads does get very high.  I was running into problems with Windows XP GDI Object resources once the number of threads reached about 200.  I then modified my program into smaller test groups to keep the number of threads at any time to less than 150.  GDI resources are no longer an issue, but the error -17400 unable to create thread happens after the first test group has completed and the second test group is just trying to run.  Note that the second test group runs fine if I skip the first test group, so the sequence itself should be okay.  I thought it might be a memory issue (even though there are no apparent memory issues seen in Windows Task Manager), so I set the "Unload after step executes" property for each of the new executions created.  That did not resolve the issue. 

 

I am trying to create a simple sequence to duplicate the error without using any of the actual test sequences that require test hardware, but have not been successful thus far.

 

Thanks for your replies and suggestions!

0 Kudos
Message 4 of 5
(3,768 Views)

Two possibilities I can think of:

 

1) It's possible that if you start the new threads too quickly after the old threads finish that they are not completely ready for reuse yet (TestStand has a threadpool and reuses threads). You might want to add a small wait after your threads finish before creating a new thread so that there is time for them to be returned back to the pool for reuse.

 

2) You might have GDI leaks in your code, such that GDI objects are not being freed after the first group so that there aren't enough left for the second group.

 

Hope this helps,

-Doug

0 Kudos
Message 5 of 5
(3,743 Views)