From c9c667d52a704fc579a17bb41f6d85cbd569ff49 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Wed, 4 Aug 2021 02:08:30 +0000 Subject: [PATCH] 8269934: RunThese24H.java failed with EXCEPTION_ACCESS_VIOLATION in java_lang_Thread::get_thread_status Reviewed-by: stuefe, dcubed, sspitsyn --- src/hotspot/share/services/threadService.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/services/threadService.cpp b/src/hotspot/share/services/threadService.cpp index cf81d535522..3540abeba83 100644 --- a/src/hotspot/share/services/threadService.cpp +++ b/src/hotspot/share/services/threadService.cpp @@ -878,7 +878,10 @@ void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) { _sleep_ticks = stat->sleep_ticks(); _sleep_count = stat->sleep_count(); - _thread_status = java_lang_Thread::get_thread_status(threadObj); + // If thread is still attaching then threadObj will be NULL. + _thread_status = threadObj == NULL ? JavaThreadStatus::NEW + : java_lang_Thread::get_thread_status(threadObj); + _is_suspended = thread->is_suspended(); _is_in_native = (thread->thread_state() == _thread_in_native);