1

I have an application that makes heavy use of the Task Parallel Library. As my application runs, I notice that the number of threads reported being used by ProcessExplorer at times exceeds 200 threads for my application and eventually the application will lock when it runs out of threads.

When a I took a FULL DUMP of the memory using AdPlus and opened it in Visual Studio, I saw 82 threads running at that time (although ProcessExplorer reported over 100 at the time).

Many of those threads (42 of them) show only the following stack trace:

ntdll.dll!_NtWaitForSingleObject@12()  + 0x15 bytes 
ntdll.dll!_NtWaitForSingleObject@12()  + 0x15 bytes 
kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 bytes    
ntdll.dll!___RtlUserThreadStart@8()  + 0x27 bytes   
ntdll.dll!__RtlUserThreadStart@8()  + 0x1b bytes    

My question is:

上記のスタック トレースを持つスレッドは、私が開始してその後孤立した何かを待っていますか? それとも、そのスタック トレースはアイドルスレッドを示しているだけですか?

4

1 に答える 1

1

したがって、WinDbg は、これらすべてのスレッドが何を行っているかという質問に対する決定的な答えを得る最良の方法であることがわかりました。

theB が述べているように、「_NtWaitForSingleObject@12 は、スレッドがアイドル状態で作業を待機しているか、スケジューラを待機していることを示します」

WinDbg で !threadpool コマンドを使用すると、これらのスレッドがスレッドプールによって所有されている必要があり、実際にアイドル状態であることを明確に示しています。

0:073> !threadpool
CPU utilization: 21%
Worker Thread: Total: 256 Running: 2 Idle: 254 MaxLimit: 1023 MinLimit: 256
Work Request in Queue: 0
--------------------------------------
Number of Timers: 1
--------------------------------------
Completion Port Thread:Total: 1 Free: 1 MaxFree: 4 CurrentLimit: 1 MaxLimit: 1000 MinLimit: 256
于 2016-02-24T23:47:48.110 に答える