Skip to content

Commit

Permalink
8253429: Error reporting should report correct state of terminated/ab…
Browse files Browse the repository at this point in the history
…orted threads

Reviewed-by: dholmes, stuefe
  • Loading branch information
zhengyu123 committed Oct 1, 2020
1 parent 2d9fa9d commit dd36d8c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/hotspot/share/runtime/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,13 +935,18 @@ void Thread::print_on_error(outputStream* st, char* buf, int buflen) const {
st->print(" \"%s\"", name());
}

st->print(" [stack: " PTR_FORMAT "," PTR_FORMAT "]",
p2i(stack_end()), p2i(stack_base()));

if (osthread()) {
st->print(" [id=%d]", osthread()->thread_id());
OSThread* os_thr = osthread();
if (os_thr != NULL) {
if (os_thr->get_state() != ZOMBIE) {
st->print(" [stack: " PTR_FORMAT "," PTR_FORMAT "]",
p2i(stack_end()), p2i(stack_base()));
st->print(" [id=%d]", osthread()->thread_id());
} else {
st->print(" terminated");
}
} else {
st->print(" unknown state (no osThread)");
}

ThreadsSMRSupport::print_info_on(this, st);
}

Expand Down Expand Up @@ -1331,6 +1336,7 @@ void NonJavaThread::post_run() {
unregister_thread_stack_with_NMT();
// Ensure thread-local-storage is cleared before termination.
Thread::clear_thread_current();
osthread()->set_state(ZOMBIE);
}

// NamedThread -- non-JavaThread subclasses with multiple
Expand Down

1 comment on commit dd36d8c

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on dd36d8c Oct 1, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.