Thread.SetThreadPoolWorkerThreadName takes way too many CPU cycles

Open
#112,608 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp

Research direction

Start by reading Thread.SetThreadPoolWorkerThreadName and the referenced issue #108057 to identify the fix that applies only to .NET 10. Check the .NET 8 branch and its existing thread-pool tests or performance coverage. Done means the fix is backported to .NET 8 and the excessive CPU usage is reduced in the reported scenario of about 30 active threads.

Written by the indexing model from the issue text.

Description

area-System.Threading tenet-performance

I've been doing some profiling and run into what appears to be the issue described here -
https://github.com/dotnet/runtime/issues/108057 - that thread is closed to comments, so I felt compelled to open a new one because it seems that the fix is in but it appears to be for .NET 10 only?

This takes a lot more CPU cycles than it should be in a mild scenario of just 30 active threads -

Image

Can the fix get backported to .NET 8 since it is current LTS and .NET 10 isn't due for a fairly long time?

Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.