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

metrics: add worker thread id #6695

Merged
merged 10 commits into from
Jul 23, 2024
Merged

Conversation

surban
Copy link
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.
@github-actions github-actions bot added R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR R-loom-multi-thread-alt Run loom multi-thread alt tests on this PR labels Jul 19, 2024
@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
tokio/tests/rt_unstable_metrics.rs Show resolved Hide resolved
tokio/tests/rt_unstable_metrics.rs Outdated Show resolved Hide resolved
@surban surban requested a review from Darksonn July 22, 2024 18:12
Copy link
Contributor

@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
Contributor

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
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.

@Darksonn Darksonn merged commit 90b23a9 into tokio-rs:master Jul 23, 2024
83 checks passed
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 R-loom-multi-thread-alt Run loom multi-thread alt tests on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants