Shorten thread names exceeding the 15-char Linux pthread_setname_np limit#125928
Shorten thread names exceeding the 15-char Linux pthread_setname_np limit#125928danmoseley merged 5 commits intomainfrom
Conversation
- .NET Stack overflow trace logger -> .NET SO Tracer (eepolicy.cpp) - .NET Stack overflow create dump -> .NET SO Dumper (excep.cpp) - .NET Tiered Compilation Worker -> .NET Tiered JIT (tieredcompilation.cpp) - .NET Long Running Task -> .NET Long Task (ThreadPoolTaskScheduler.cs) - .NET ThreadPool IO -> .NET TP I/O (PortableThreadPool.IO.Windows.cs) - .NET SynchManager -> .NET Synch Mgr (synchmanager.cpp) Fixes: linux pthread_setname_np silently truncating names > 15 chars Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/a38ad624-ca24-4ec4-909a-8c3265181984
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
|
@copilot Review all code and tests in the repo for copies of these strings and update them as appropriate. Note that that string can be shortened. For example, |
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/10921e85-2536-4fa5-a782-44aa9b6732b1
Done in 02f058b. Updated |
danmoseley
left a comment
There was a problem hiding this comment.
@hoyosjs can you confirm no debugger dependency concerns?
|
Past changes like this |
There was a problem hiding this comment.
Pull request overview
This PR shortens several internal runtime thread names to fit Linux’s 15-character pthread_setname_np limit so that thread names remain distinguishable in system tools and debuggers, and keeps the Mono browser WASM threading layer in sync for long-running thread identification.
Changes:
- Renames stack overflow helper threads to shorter, distinct names (
.NET SO Tracer,.NET SO Dumper). - Renames tiered compilation background worker thread to
.NET Tiered JIT(15 chars). - Renames managed long-running task thread, Windows threadpool I/O poller thread, and PAL SynchManager worker thread to shorter names (including syncing the WASM worker-thread identification string).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/mono/browser/runtime/pthreads/worker-thread.ts | Updates the hardcoded long-running thread name check to match the new runtime thread name. |
| src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/ThreadPoolTaskScheduler.cs | Shortens the dedicated LongRunning task thread name. |
| src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.IO.Windows.cs | Shortens the Windows IO completion poller thread name for consistency and readability. |
| src/coreclr/vm/tieredcompilation.cpp | Shortens the tiered compilation background worker thread name to fit Linux’s limit. |
| src/coreclr/vm/excep.cpp | Shortens the stack overflow “createdump” helper thread name to avoid truncation. |
| src/coreclr/vm/eepolicy.cpp | Shortens the stack overflow stack trace logging helper thread name to avoid truncation. |
| src/coreclr/pal/src/synchmgr/synchmanager.cpp | Shortens the synchronization manager worker thread name to avoid truncation. |
src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.IO.Windows.cs
Show resolved
Hide resolved
Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/aad0daaf-b02d-4a6f-b844-dae63308ef71
|
I was curious what the synch manager is and apparently it's the PAL way of simulating Windows cross process synchronization primitives. |
Linux silently truncates thread names to 15 characters via
pthread_setname_np, making several runtime threads indistinguishable inps,top,htop, and debuggers.Description
Renamed six thread names that exceeded the limit across all affected files, including the Mono browser WASM runtime:
.NET Stack overflow trace logger(33).NET SO Tracer(14).NET Stack overflow create dump(32).NET SO Dumper(14).NET Tiered Compilation Worker(30).NET Tiered JIT(15).NET Long Running Task(22).NET Long Task(14).NET ThreadPool IO(18).NET TP I/O(11).NET SynchManager(18).NET Sync Mgr(13)All other runtime thread names (
.NET TP Worker,.NET Finalizer,.NET EventPipe, etc.) were already within the limit and are unchanged.The rename of
.NET Long Running Task→.NET Long Taskis also applied insrc/mono/browser/runtime/pthreads/worker-thread.ts, which hardcodes the name to identify long-running threads in the Mono browser WASM threading layer.Original prompt
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.