Skip to content
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

Make thread names of CoroutineScheduler more distinguishable #4267

Open
qwwdfsad opened this issue Nov 5, 2024 · 0 comments
Open

Make thread names of CoroutineScheduler more distinguishable #4267

qwwdfsad opened this issue Nov 5, 2024 · 0 comments

Comments

@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Nov 5, 2024

Currently, names of all threads that belong to CoroutineScheduler (Dispatchers.Default, Dispatchers.IO and Dispatchers.IO.limitedParallelism(...) are named DefaultDispatcher-worker-* which might be quite confusing to look at in thread dumps (i.e. it's possible to have dozens of such threads on 8 core machine).
Example of such confusion: https://stackoverflow.com/questions/78502056/why-thread-name-is-defaultdispatcher-worker-even-though-i-specify-function-to-ru

While we cannot leverage Thread.setName because of its performance impact, we still can sweeten the pill:

  • Name the thread somehow more generic (for example: CoroutineScheduler-worker-, something like shared-pool-worker-, coroutine-pool-worker- etc.)
  • Add an artificial stackframe that indicates that the thread was spawned and/or is parked as part of the "IO" pool if it's possible implementation-wise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant