Conversation
I'm doing some tracing with `bpftrace` and it shows `comm` as `tokio-runtime-w`. This ensures it shows `bootc` as one would expect. Signed-off-by: Colin Walters <walters@verbum.org>
There was a problem hiding this comment.
Code Review
This pull request aims to set the Tokio thread name for better traceability. While the code change itself is correct for setting the thread name prefix for Tokio's blocking thread pool, there seems to be a discrepancy with the problem description. The change will affect threads named tokio-blocking-N, but the description mentions tokio-runtime-w, which corresponds to worker threads of a multi-threaded runtime. The current implementation uses a single-threaded runtime, which does not have worker threads. I've added a comment to clarify this point, as the change might not solve the issue you're observing.
| // tokio::task::spawn_blocking to create a new OS thread explicitly. | ||
| let runtime = tokio::runtime::Builder::new_current_thread() | ||
| .enable_all() | ||
| .thread_name("bootc") |
There was a problem hiding this comment.
This change sets the name for threads in the blocking pool, which are named tokio-blocking-N by default. Your PR description mentions you are seeing tokio-runtime-w, which is the default name for worker threads in a multi-threaded Tokio runtime.
The runtime here is created with new_current_thread(), which does not have worker threads, only a blocking pool. This change will rename threads from tokio-blocking-N to bootc-N, but it will not affect any threads named tokio-runtime-w.
Could you please double-check the thread name you are seeing? If it is indeed tokio-runtime-w, then those threads are likely being created by a different Tokio runtime, and this change will not affect them.
I'm doing some tracing with
bpftraceand it showscommastokio-runtime-w. This ensures it showsbootcas one would expect.