Skip to content

Add option to include all threads in dotnet-stack reports #5193

@andredasilvapinto

Description

@andredasilvapinto

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions