Skip to content

Commit dd36d8c

Browse files
committed
8253429: Error reporting should report correct state of terminated/aborted threads
Reviewed-by: dholmes, stuefe
1 parent 2d9fa9d commit dd36d8c

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/hotspot/share/runtime/thread.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -935,13 +935,18 @@ void Thread::print_on_error(outputStream* st, char* buf, int buflen) const {
935935
st->print(" \"%s\"", name());
936936
}
937937

938-
st->print(" [stack: " PTR_FORMAT "," PTR_FORMAT "]",
939-
p2i(stack_end()), p2i(stack_base()));
940-
941-
if (osthread()) {
942-
st->print(" [id=%d]", osthread()->thread_id());
938+
OSThread* os_thr = osthread();
939+
if (os_thr != NULL) {
940+
if (os_thr->get_state() != ZOMBIE) {
941+
st->print(" [stack: " PTR_FORMAT "," PTR_FORMAT "]",
942+
p2i(stack_end()), p2i(stack_base()));
943+
st->print(" [id=%d]", osthread()->thread_id());
944+
} else {
945+
st->print(" terminated");
946+
}
947+
} else {
948+
st->print(" unknown state (no osThread)");
943949
}
944-
945950
ThreadsSMRSupport::print_info_on(this, st);
946951
}
947952

@@ -1331,6 +1336,7 @@ void NonJavaThread::post_run() {
13311336
unregister_thread_stack_with_NMT();
13321337
// Ensure thread-local-storage is cleared before termination.
13331338
Thread::clear_thread_current();
1339+
osthread()->set_state(ZOMBIE);
13341340
}
13351341

13361342
// NamedThread -- non-JavaThread subclasses with multiple

0 commit comments

Comments
 (0)