temporary: Dump the threads stack traces when .wait_task() times out

Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
This commit is contained in:
Martin Tzvetanov Grigorov 2025-06-06 09:51:18 +03:00
parent 3770e70581
commit 89c0cf9b12
No known key found for this signature in database
GPG Key ID: 3194FD8C1AE300EF
3 changed files with 15 additions and 6 deletions

View File

@ -1,2 +1,5 @@
[alias]
xtask = "run --release --package xtask --"
[build]
rustflags = ["--cfg", "tokio_unstable", "--cfg", "tokio_taskdump"]

View File

@ -158,6 +158,8 @@ jobs:
uses: Swatinem/rust-cache@v2.7.8
- name: Run tests in debug
uses: actions-rs/cargo@v1
env:
RUSTFLAGS: "--cfg tokio_unstable --cfg tokio_taskdump"
with:
command: test
args: --locked --all

View File

@ -400,14 +400,10 @@ impl<State> Server<State> {
// try several times to get status, or panic to not wait forever
let url = format!("/tasks/{}", update_id);
// Increase timeout for vector-related tests
let max_attempts = if url.contains("/tasks/") {
if update_id > 1000 {
let max_attempts = if update_id > 1000 {
400 // 200 seconds for vector tests
} else {
100 // 50 seconds for other tests
}
} else {
100 // 50 seconds for other tests
};
for _ in 0..max_attempts {
@ -421,6 +417,14 @@ impl<State> Server<State> {
// wait 0.5 second.
sleep(Duration::from_millis(500)).await;
}
let handle = tokio::runtime::Handle::current();
if let Ok(dump) = tokio::time::timeout(Duration::from_secs(2), handle.dump()).await {
for (i, task) in dump.tasks().iter().enumerate() {
let trace = task.trace();
println!("TASK {i}:");
println!("{trace}\n");
}
}
panic!("Timeout waiting for update id");
}