LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx producing many system threads

Solved!
Go to solution

Could you verify your version of NI-DAQmx as well?  You can do this by opening MAX, expanding the Software section, and looking for NI-DAQmx Device Driver.

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 11 of 16
(692 Views)

Hi estiers,

 

Thanks for posting your code. I didn't run it, but I noticed that it uses a mixture of DAQmx and DAQmx Base VIs. I think the problem is that "Collect Data.vi" uses "DAQmxBase Clear Task.vi" with a DAQmx task. Clearing an invalid DAQmx task does not generate an error, and I assume that DAQmx Base matches this behavior, so this VI leaks the tasks and all of their resources (including system threads).

 

Why doesn't "Collect Data.vi" leak when you run it in isolation? By default, DAQmx tells LabVIEW to automatically clean up tasks when the top-level VI stops executing. Only when you keep the top-level VI running for a long time (like with "This one makes threads.vi") will you actually see the effects of a VI that leaks DAQmx tasks. Note that you can disable auto-cleanup for a specific task using "DAQmx Create Task.vi":

 

Auto Cleanup.png

 

Anyway, please try replacing the DAQmx Base VIs with DAQmx VIs and see if that solves the problem.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 12 of 16
(678 Views)

>Seth B.: Could you verify your version of NI-DAQmx as well?  You can do this by opening MAX, expanding the Software section, and looking for NI-DAQmx Device Driver.

 

I didn't find an entry exactly matching the term "NI-DAQmx Device Driver", here's what I did find:

NI-DAQmx 8.7.2

NI-DAQmx Base 3.2

 

>Brad K: Anyway, please try replacing the DAQmx Base VIs with DAQmx VIs and see if that solves the problem.

 

Thanks for the suggestion, I removed "Base Clear Task.vi" from both channels, and I didn't see any other DAQmx Base VIs. The extra threads still appear when "Collect Data.vi" is run as a sub-VI. I think the explanation of why extra threads appear only when run as a sub-VI makes sense, but it looks like the leak still exists.

 

I'll be out for about a week for Christmas break, but I'll keep working on this problem after I get back on the 28th. Thanks again for all the help.

0 Kudos
Message 13 of 16
(649 Views)

Hi estiers,

 

Did you remove the DAQmx Base Clear Task VIs entirely, or did you replace them with DAQmx Clear Task VIs?

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 14 of 16
(641 Views)

I removed them entirely, and in re-reading your first post I now see that I should have replaced them with the non-Base version. I'll try that next time I get on the system.

 

Thanks!

0 Kudos
Message 15 of 16
(634 Views)

I removed the DAQmx Base Clear Task VIs and replaced them with the DAQmx Clear Task VIs. The system can run for extended periods now without producing extra threads. It looks like the problem was caused by mixing the two types of VIs.

 

Thanks again to all that helped!

 

Message 16 of 16
(605 Views)