JDK-8318631 : GetStackTraceSuspendedStressTest.java failed with: check_jvmti_status: JVMTI function returned error: JVMTI_ERROR_THREAD_NOT_ALIVE (15)
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 21-pool-oracle,22
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • CPU: generic
  • Submitted: 2023-10-21
  • Updated: 2024-11-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25Unresolved
Related Reports
Relates :  
Relates :  
Relates :  
Description
The following test failed in the JDK22 CI:

serviceability/jvmti/stress/StackTrace/Suspended/GetStackTraceSuspendedStressTest.java

Here's a snippet from the log file:

#section:main
----------messages:(6/357)----------
command: main -agentlib:GetStackTraceSuspendedStress GetStackTraceSuspendedStressTest
reason: User specified action: run main/othervm/native -agentlib:GetStackTraceSuspendedStress GetStackTraceSuspendedStressTest 
started: Sat Oct 21 07:28:16 UTC 2023
Mode: othervm [/othervm specified]
finished: Sat Oct 21 07:28:42 UTC 2023
elapsed time (seconds): 25.432
----------configuration:(0/0)----------
----------System.out:(139/4551)----------
Agent_OnLoad started
Agent_OnLoad finished
Synchronization point checkStatus(0) called.
Data 0x7f1f8401f590 0x7f1f8401f9e0
Agent: waiting to start
Agent: started
VThread-Producer-4: started
VThread-Producer-5: started
VThread-Consumer-2: started

<snip>

VThread-Producer-59: started
VThread-Consumer-59: started
VThread-Consumer-6: started
VThread-Consumer-4: started
VThread-Producer-1: finished
check_jvmti_status: JVMTI function returned error: JVMTI_ERROR_THREAD_NOT_ALIVE (15)
FATAL ERROR in native method: Error in JVMTI SetEventNotificationMode: disable SINGLE_STEP
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xf8d1a2]  jni_FatalError+0x92VThread-Consumer-8: finished
VThread-Consumer-5: finished
  (jni.cpp:631)
C  [libGetStackTraceSuspendedStress.so+0x4b12]  agentProc(_jvmtiEnv*, JNIEnv_*, void*)+0x3f2  (jni.h:844)
C  [libGetStackTraceSuspendedStress.so+0x24c2]  agent_thread_wrapper+0x32  (jvmti_thread.h:179)
V  [libjvm.so+0x11a8939]  JvmtiAgentThread::call_start_function()+0x59  (jvmtiImpl.cpp:89)
V  [libjvm.so+0xec37dc]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:720)
V  [libjvm.so+0x179bc1a]  Thread::call_run()+0xba  (thread.cpp:220)
V  [libjvm.so+0x14a650a]  thread_native_entry(Thread*)+0x12a  (os_linux.cpp:785)
----------System.err:(0/0)----------
----------rerun:(45/8102)*----------

This is the fourth recent failure mode for this same test.
Comments
My conclusion that it is a test bug was wrong. It seems that virtual threads suspended with the JVMTI SuspendThread() can be terminated. It looks like a JVMTI bug and my fix in the published PR is incorrect. So far, the problem is observed with -Xcomp only.
06-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16488 Date: 2023-11-03 04:31:33 +0000
03-11-2023

This failure mode is reproducible. I'm sure it is a test bug. The suggested fix is: diff --git a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp index 65e79fb33f2..468a5301ce7 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp @@ -121,6 +121,10 @@ check_vthread_consistency_suspended(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthrea //const char* cname = (cthread == NULL) ? "<no cthread>" : get_thread_name(jvmti, jni, cthread); err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, vthread); + if (err == JVMTI_ERROR_THREAD_NOT_ALIVE || + err == JVMTI_ERROR_WRONG_PHASE) { + return; + } check_jvmti_status(jni, err, "Error in JVMTI SetEventNotificationMode: enable SINGLE_STEP"); if (cthread != NULL) { // pre-condition for reliable testing @@ -129,6 +133,10 @@ check_vthread_consistency_suspended(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthrea } err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, vthread); + if (err == JVMTI_ERROR_THREAD_NOT_ALIVE || + err == JVMTI_ERROR_WRONG_PHASE) { + return; + } check_jvmti_status(jni, err, "Error in JVMTI SetEventNotificationMode: disable SINGLE_STEP"); }
27-10-2023