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

Test worker_steal_count hangs sometimes #6470

Open
Darksonn opened this issue Apr 7, 2024 · 0 comments
Open

Test worker_steal_count hangs sometimes #6470

Darksonn opened this issue Apr 7, 2024 · 0 comments
Labels
A-ci Area: The continuous integration setup A-tokio Area: The main tokio crate E-help-wanted Call for participation: Help is requested to fix this issue. M-metrics Module: tokio/runtime/metrics

Comments

@Darksonn
Copy link
Contributor

Darksonn commented Apr 7, 2024

I tried fixing this in the past with #6327, but it seems like that attempt was not enough to fix it, because it's still happening.

#[test]
fn worker_steal_count() {
// This metric only applies to the multi-threaded runtime.
//
// We use a blocking channel to backup one worker thread.
use std::sync::mpsc::channel;
let rt = threaded_no_lifo();
let metrics = rt.metrics();
rt.block_on(async {
let (tx, rx) = channel();
// Move to the runtime.
tokio::spawn(async move {
// Spawn the task that sends to the channel
//
// Since the lifo slot is disabled, this task is stealable.
tokio::spawn(async move {
tx.send(()).unwrap();
});
// Blocking receive on the channel.
rx.recv().unwrap();
})
.await
.unwrap();
});
drop(rt);
let n: u64 = (0..metrics.num_workers())
.map(|i| metrics.worker_steal_count(i))
.sum();
assert_eq!(1, n);
}

For now, I've ignored the test in #6471, but it should be fixed.

@Darksonn Darksonn added A-tokio Area: The main tokio crate A-ci Area: The continuous integration setup M-metrics Module: tokio/runtime/metrics labels Apr 7, 2024
@Darksonn Darksonn added the E-help-wanted Call for participation: Help is requested to fix this issue. label Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ci Area: The continuous integration setup A-tokio Area: The main tokio crate E-help-wanted Call for participation: Help is requested to fix this issue. M-metrics Module: tokio/runtime/metrics
Projects
None yet
Development

No branches or pull requests

1 participant