-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WaitHandleWait profiler #5814
Comments
Hi @verdie-g thanks for the FR, that's really interesting. Thread starvation is a kind of things we are trying to detect and report in our UI. We can collect this event and it will be done for all managed threads. As of today, the filter is done in the UI (using the name/id...). Just to be sure, and make this useful for everyone: We'll let you know about the status of this FR. |
I would like to see a flamegraph of the waits just like the contention. Ideally, the unit would but the wait time. The number of events can be extremely misleading. Unlike the contention event, it was decided not to include it in the wait event. In my custom perfview, I use the thread id of the event to match the start and the stop. As a metric, the total wait time could also be interesting. For example, when a spike of latency is observed between two services but the calling service has a spike of wait time, it could help understand that the issue is not in the called service. |
Thanks, I'll create a FR on our backlog and we'll have to plan it. |
@verdie-g : I'm starting to work on the possible integration of these new events into our contention profiler. Is it expected that "noisy" very short waits happen? |
Do you have the stack traces for those? There are many code paths, internal to the runtime, that could lead to a wait event to be emitted. See this dotnet/runtime#94737 (comment). Though, in my investigations I've never seen them, or maybe they were filtered out by my tooling. |
Here is the source code of the test application:
|
Interesting: they appear only with the call to Console.ReadLine... |
Is your feature request related to a problem? Please describe.
Thread pool starvation is a very common performance issue in the services of my company. They are usually caused by sync-over-async. It can be relatively easy to find them when it's a continuous issue, but it gets tricky when it occurs the callback of a 15 minutes timer.
Describe the solution you'd like
In .NET 9+, I added an event (dotnet/runtime#94737) that is emitted whenever a managed thread is blocked (Monitor.Wait, Task.Wait, MRES.Wait, SemaphoreSlim.Wait, ...). It would be awesome if this event was collected just like the exceptions, allocations, contention profilers.
One annoying this about this event is that most occurrences will usually happen in non-thread-pool threads that spend most of their time blocking. For that, I opened dotnet/runtime#102326.
Describe alternatives you've considered
Currently, I took super long traces of the WaitHandleWait event and try to find the issue in PerfView but it's not reliable.
The text was updated successfully, but these errors were encountered: