Skip to content

Commit

Permalink
8321069: JvmtiThreadState::state_for_while_locked() returns nullptr f…
Browse files Browse the repository at this point in the history
…or an attached JNI thread with a java.lang.Thread object after JDK-8319935

Reviewed-by: dholmes, jiangli, sspitsyn
  • Loading branch information
Daniel D. Daugherty committed Dec 4, 2023
1 parent bd04f91 commit 30b5d42
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/hotspot/share/prims/jvmtiThreadState.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ inline JvmtiThreadState* JvmtiThreadState::state_for_while_locked(JavaThread *th
JvmtiThreadState *state = thread == nullptr ? nullptr : thread->jvmti_thread_state();

if (state == nullptr && thread != nullptr &&
(thread->is_exiting() || thread->is_attaching_via_jni())) {
// Don't add a JvmtiThreadState to a thread that is exiting or is attaching.
// When a thread is attaching, it may not have a Java level thread object
// created yet.
(thread->is_exiting() ||
(thread->threadObj() == nullptr && thread->is_attaching_via_jni())
)) {
// Don't add a JvmtiThreadState to a thread that is exiting, or is attaching
// and does not yet have a Java level thread object allocated.
return nullptr;
}

Expand Down

0 comments on commit 30b5d42

Please sign in to comment.