-
Notifications
You must be signed in to change notification settings - Fork 386
Description
Background and Motivation
We monitor the number of process threads via Process.GetCurrentProcess().Threads.Count and have been noticing a continuous increase in this metric, which seems to indicate a potential thread leak. In order to investigate this, I tried using dotnet-stack, but the total number of stack frames that it prints is much smaller than what is reported by the Threads.Count metric or the output of ps -T -p <PID> on Linux.
The documentation for report says:
Prints the stack trace for each thread in the target process.
which doesn't seem to be correct.
By looking at the (short) thread names, I can see that for example none of the ".NET Server GC" or ".NET BGC" are reported, but there are more cases. It is difficult to know exactly which threads are missing as dotnet-stack does not include the thread name in its output (something that would also be very useful and is present in the JVM equivalent jstack).
It would be useful to provide an option to output the exhaustive list of all threads in the process.
Proposed Feature
Add option to include all process threads in the dotnet-stack report output