Skip to content

metrics: add worker thread id#6695

Merged
Darksonn merged 10 commits intotokio-rs:masterfrom
surban:metrics-thread-id
Jul 23, 2024
Merged

metrics: add worker thread id#6695
Darksonn merged 10 commits intotokio-rs:masterfrom
surban:metrics-thread-id

Conversation

@surban
Copy link
Copy Markdown
Contributor

@surban surban commented Jul 19, 2024

This allows querying the thread id of each worker thread.

Additional information, such as native thread id, can be collected using runtime::Builder::on_thread_start() and correlated using the thread id.

Motivation

See #6353 and discussion in #6370.

Solution

Provides thread ids of workers, so that a stuck worker can be correlated to a thread.

This allows querying the thread id of each worker thread.

Additional information, such as native thread id, can be
collected using runtime::Builder::on_thread_start() and
correlated using the thread id.
@mox692 mox692 added A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime M-metrics Module: tokio/runtime/metrics labels Jul 20, 2024
Comment thread tokio/tests/rt_unstable_metrics.rs
Comment thread tokio/tests/rt_unstable_metrics.rs Outdated
@surban surban requested a review from Darksonn July 22, 2024 18:12
Copy link
Copy Markdown
Member

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This looks good to me.

Comment on lines +136 to +138
/// If additional information about the thread, such as its native id, are
/// required, those can be collected in [`on_thread_start`] and correlated
/// using the thread id.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is enough for your purposes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for now we just want to send SIGABRT to the hanging thread and for that we collect the pthread_t id of each worker thread in on_thread_start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tokio Area: The main tokio crate M-metrics Module: tokio/runtime/metrics M-runtime Module: tokio/runtime R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants