diff --git a/src/hotspot/share/jfr/utilities/jfrThreadIterator.cpp b/src/hotspot/share/jfr/utilities/jfrThreadIterator.cpp index 956224a80d9..ced5973b1c5 100644 --- a/src/hotspot/share/jfr/utilities/jfrThreadIterator.cpp +++ b/src/hotspot/share/jfr/utilities/jfrThreadIterator.cpp @@ -38,6 +38,9 @@ static bool java_thread_inclusion_predicate(JavaThread* jt, bool live_only) { if (live_only && jt->thread_state() == _thread_new) { return false; } + if (jt->is_attaching_via_jni()) { + return false; + } return thread_inclusion_predicate(jt); }