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

admin service /threadz dumps waiting and sleeping threads on verbose=… #15077

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 35 additions & 31 deletions crates/aptos-system-utils/src/thread_dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,33 +91,35 @@ async fn do_thread_dump(
let mut body = String::new();
for thread in trace.threads() {
let frames = thread.frames();
if !frames.is_empty() {
let symbols = frames[0].symbols();
if !symbols.is_empty() {
if let Some(name) = symbols[0].name() {
if name.contains("epoll_wait") {
wait_threads.push(thread.name());
continue;
}
if !verbose {
if !frames.is_empty() {
let symbols = frames[0].symbols();
if !symbols.is_empty() {
if let Some(name) = symbols[0].name() {
if name.contains("epoll_wait") {
wait_threads.push(thread.name());
continue;
}

if name.contains("clock_nanosleep") {
sleep_threads.push(thread.name());
continue;
if name.contains("clock_nanosleep") {
sleep_threads.push(thread.name());
continue;
}
}
}
}
}

if frames.len() > 1 {
let symbols = frames[1].symbols();
if !symbols.is_empty() {
if let Some(name) = symbols[0].name() {
if name.contains("futex_wait")
|| name.contains("pthread_cond_wait")
|| name.contains("pthread_cond_timedwait")
{
wait_threads.push(thread.name());
continue;
if frames.len() > 1 {
let symbols = frames[1].symbols();
if !symbols.is_empty() {
if let Some(name) = symbols[0].name() {
if name.contains("futex_wait")
|| name.contains("pthread_cond_wait")
|| name.contains("pthread_cond_timedwait")
{
wait_threads.push(thread.name());
continue;
}
}
}
}
Expand Down Expand Up @@ -157,17 +159,19 @@ async fn do_thread_dump(
body.push_str("\n\n");
}

body.push_str("Wait threads:");
for wait_thread in wait_threads {
body.push_str(&format!(" {wait_thread}"));
}
body.push_str("\n\n");
if !verbose {
body.push_str("Wait threads:");
for wait_thread in wait_threads {
body.push_str(&format!(" {wait_thread}"));
}
body.push_str("\n\n");

body.push_str("Sleep threads:");
for sleep_thread in sleep_threads {
body.push_str(&format!(" {sleep_thread}"));
body.push_str("Sleep threads:");
for sleep_thread in sleep_threads {
body.push_str(&format!(" {sleep_thread}"));
}
body.push_str("\n\n");
}
body.push_str("\n\n");

Ok(body)
}
Loading