JDK-8318536 : GetStackTraceSuspendedStressTest.java failed with SIGFPE in SingleStep event handler
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 22
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2023-10-19
  • Updated: 2024-05-09
  • Resolved: 2024-05-09
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 23
23Resolved
Related Reports
Duplicate :  
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: Thu Oct 19 01:19:33 UTC 2023
Mode: othervm [/othervm specified]
finished: Thu Oct 19 01:19:56 UTC 2023
elapsed time (seconds): 23.018
----------configuration:(0/0)----------
----------System.out:(77/4249)----------
Agent_OnLoad started
Agent_OnLoad finished
Synchronization point checkStatus(0) called.
Data 0x7f170801fa20 0x7f170801fe40
Agent: waiting to start
Agent: started
VThread-Consumer-1: started
VThread-Consumer-2: started
VThread-Consumer-4: started
VThread-Producer-5: started
VThread-Producer-4: started
VThread-Consumer-5: started
VThread-Producer-0: started
VThread-Consumer-0: started
VThread-Producer-2: started
VThread-Consumer-3: started
VThread-Producer-3: started
VThread-Producer-7: started
VThread-Consumer-7: started
VThread-Producer-8: started

<snip>

JVMTI Stack Trace for thread ForkJoinPool-1-worker-7: frame count: 9
 0: jdk/internal/vm/Continuation: run()V
 1: java/lang/VirtualThread: runContinuation()V
 2: java/lang/VirtualThread$$Lambda.0x00007f169f0502d8: run()V
 3: java/util/concurrent/ForkJoinTask$RunnableExecuteAction: exec()Z
 4: java/util/concurrent/ForkJoinTask: doExec()I
 5: java/util/concurrent/ForkJoinPool$WorkQueue: topLevelExec(Ljava/util/concurrent/ForkJoinTask;Ljava/util/concurrent/ForkJoinPool$WorkQueue;)V
 6: java/util/concurrent/ForkJoinPool: scan(Ljava/util/concurrent/ForkJoinPool$WorkQueue;II)I
 7: java/util/concurrent/ForkJoinPool: runWorker(Ljava/util/concurrent/ForkJoinPool$WorkQueue;)V
 8: java/util/concurrent/ForkJoinWorkerThread: run()V

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGFPE (0x8) at pc=0x00007f17118c7e02, pid=2229663, tid=2229769
#
# JRE version: Java(TM) SE Runtime Environment (22.0+20) (fastdebug build 22-ea+20-1565)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-ea+20-1565, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  [libGetStackTraceSuspendedStress.so+0x2e02]  SingleStep(_jvmtiEnv*, JNIEnv_*, _jobject*, _jmethodID*, long)+0xa2
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /opt/mach5/mesos/work_dir/slaves/afbc6042-3a24-4198-9369-18c663a3f74c-S26253/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/023eb3d9-a059-47a5-8545-c11c4471e69d/runs/a42b7d26-9573-47a1-a78b-242f1a5e4b40/testoutput/test-support/jtreg_open_test_hotspot_jtreg_hotspot_serviceability/scratch/2/core.2229663)
#
# An error report file with more information is saved as:
# /opt/mach5/mesos/work_dir/slaves/afbc6042-3a24-4198-9369-18c663a3f74c-S26253/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/023eb3d9-a059-47a5-8545-c11c4471e69d/runs/a42b7d26-9573-47a1-a78b-242f1a5e4b40/testoutput/test-support/jtreg_open_test_hotspot_jtreg_hotspot_serviceability/scratch/2/hs_err_pid2229663.log
[thread 2229768 also had an error]
[20.199s][warning][os] Loading hsdis library failed
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
----------System.err:(0/0)----------
----------rerun:(45/8114)*----------


Here's the crashing thread's stack:

---------------  T H R E A D  ---------------

Current thread (0x00007f162c000fd0):  JavaThread "ForkJoinPool-1-worker-7" daemon [_thread_in_native, id=2229769, stack(0x00007f16dff00000,0x00007f16e0000000) (1024K)]

Stack: [0x00007f16dff00000,0x00007f16e0000000],  sp=0x00007f16dfffe1e0,  free space=1016k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libGetStackTraceSuspendedStress.so+0x2e02]  SingleStep(_jvmtiEnv*, JNIEnv_*, _jobject*, _jmethodID*, long)+0xa2  (libGetStackTraceSuspendedStress.cpp:153)
V  [libjvm.so+0x119bd3b]  JvmtiExport::post_single_step(JavaThread*, Method*, unsigned char*)+0x1fb  (jvmtiExport.cpp:1991)
V  [libjvm.so+0x119bf8a]  JvmtiExport::at_single_stepping_point(JavaThread*, Method*, unsigned char*)+0xaa  (jvmtiExport.cpp:1335)
V  [libjvm.so+0xe75978]  InterpreterRuntime::at_safepoint(JavaThread*)+0x118  (interpreterRuntime.cpp:1149)
j  java.nio.CharBuffer.limit(I)Ljava/nio/Buffer;+0 java.base@22-ea
J 1377 c2 java.nio.Buffer.<init>(IIIILjava/lang/foreign/MemorySegment;)V java.base@22-ea (105 bytes) @ 0x00007f16fcfa1004 [0x00007f16fcfa0f00+0x0000000000000104]
J 1758 c2 java.nio.CharBuffer.<init>(IIII[CILjava/lang/foreign/MemorySegment;)V java.base@22-ea (24 bytes) @ 0x00007f16fd06942c [0x00007f16fd0693e0+0x000000000000004c]
J 2986 c2 java.nio.CharBuffer.wrap([CII)Ljava/nio/CharBuffer; java.base@22-ea (21 bytes) @ 0x00007f16fd36a190 [0x00007f16fd36a0e0+0x00000000000000b0]
J 2985 c2 sun.nio.cs.StreamEncoder.lockedWrite([CII)V java.base@22-ea (53 bytes) @ 0x00007f16fd36795c [0x00007f16fd3678e0+0x000000000000007c]
J 2984 c2 sun.nio.cs.StreamEncoder.write([CII)V java.base@22-ea (82 bytes) @ 0x00007f16fd36a788 [0x00007f16fd36a700+0x0000000000000088]
J 2983 c2 java.io.OutputStreamWriter.write([CII)V java.base@22-ea (11 bytes) @ 0x00007f16fd365b0c [0x00007f16fd365ac0+0x000000000000004c]
J 2982 c2 java.io.BufferedWriter.flushBuffer()V java.base@22-ea (63 bytes) @ 0x00007f16fd3660f0 [0x00007f16fd366000+0x00000000000000f0]
J 2915 c2 java.io.PrintStream.implWriteln(Ljava/lang/String;)V java.base@22-ea (48 bytes) @ 0x00007f16fd34f3f8 [0x00007f16fd34f320+0x00000000000000d8]
J 2910 c2 java.io.PrintStream.writeln(Ljava/lang/String;)V java.base@22-ea (81 bytes) @ 0x00007f16fd33bc00 [0x00007f16fd33bb80+0x0000000000000080]
J 2744  jdk.internal.vm.Continuation.enterSpecial(Ljdk/internal/vm/Continuation;ZZ)V java.base@22-ea (0 bytes) @ 0x00007f16fd2fb753 [0x00007f16fd2fb5e0+0x0000000000000173]
J 2829 c2 jdk.internal.vm.Continuation.run()V java.base@22-ea (586 bytes) @ 0x00007f16fd332fb4 [0x00007f16fd332a80+0x0000000000000534]
J 2743 c2 java.lang.VirtualThread.runContinuation()V java.base@22-ea (135 bytes) @ 0x00007f16fd2ffcec [0x00007f16fd2ffbc0+0x000000000000012c]
J 2823 c2 java.lang.VirtualThread$$Lambda+0x00007f169f0502d8.run()V java.base@22-ea (8 bytes) @ 0x00007f16fd31258c [0x00007f16fd312540+0x000000000000004c]
J 2821 c2 java.util.concurrent.ForkJoinTask.doExec()I java.base@22-ea (37 bytes) @ 0x00007f16fd3129e0 [0x00007f16fd312960+0x0000000000000080]
J 2820 c2 java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Ljava/util/concurrent/ForkJoinTask;Ljava/util/concurrent/ForkJoinPool$WorkQueue;)V java.base@22-ea (83 bytes) @ 0x00007f16fd31fbf8 [0x00007f16fd31fb60+0x0000000000000098]
J 2814 c2 java.util.concurrent.ForkJoinPool.scan(Ljava/util/concurrent/ForkJoinPool$WorkQueue;II)I java.base@22-ea (263 bytes) @ 0x00007f16fd31b1e0 [0x00007f16fd31afc0+0x0000000000000220]
j  java.util.concurrent.ForkJoinPool.runWorker(Ljava/util/concurrent/ForkJoinPool$WorkQueue;)V+35 java.base@22-ea
J 2807 c2 java.util.concurrent.ForkJoinWorkerThread.run()V java.base@22-ea (180 bytes) @ 0x00007f16fd31d5e8 [0x00007f16fd31d560+0x0000000000000088]
v  ~StubRoutines::call_stub 0x00007f16fcb4dd21
V  [libjvm.so+0xe8d037]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x477  (javaCalls.cpp:415)
V  [libjvm.so+0xe8d681]  JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x331  (javaCalls.cpp:329)
V  [libjvm.so+0xe8d895]  JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, JavaThread*)+0x75  (javaCalls.cpp:191)
V  [libjvm.so+0xfe6ad3]  thread_entry(JavaThread*, JavaThread*)+0x93  (jvm.cpp:2935)
V  [libjvm.so+0xec26fc]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:720)
V  [libjvm.so+0x179698a]  Thread::call_run()+0xba  (thread.cpp:220)
V  [libjvm.so+0x14a51aa]  thread_native_entry(Thread*)+0x12a  (os_linux.cpp:785)
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  java.nio.CharBuffer.limit(I)Ljava/nio/Buffer;+0 java.base@22-ea
J 1377 c2 java.nio.Buffer.<init>(IIIILjava/lang/foreign/MemorySegment;)V java.base@22-ea (105 bytes) @ 0x00007f16fcfa1004 [0x00007f16fcfa0f00+0x0000000000000104]
J 1758 c2 java.nio.CharBuffer.<init>(IIII[CILjava/lang/foreign/MemorySegment;)V java.base@22-ea (24 bytes) @ 0x00007f16fd06942c [0x00007f16fd0693e0+0x000000000000004c]
J 2986 c2 java.nio.CharBuffer.wrap([CII)Ljava/nio/CharBuffer; java.base@22-ea (21 bytes) @ 0x00007f16fd36a190 [0x00007f16fd36a0e0+0x00000000000000b0]
J 2985 c2 sun.nio.cs.StreamEncoder.lockedWrite([CII)V java.base@22-ea (53 bytes) @ 0x00007f16fd36795c [0x00007f16fd3678e0+0x000000000000007c]
J 2984 c2 sun.nio.cs.StreamEncoder.write([CII)V java.base@22-ea (82 bytes) @ 0x00007f16fd36a788 [0x00007f16fd36a700+0x0000000000000088]
J 2983 c2 java.io.OutputStreamWriter.write([CII)V java.base@22-ea (11 bytes) @ 0x00007f16fd365b0c [0x00007f16fd365ac0+0x000000000000004c]
J 2982 c2 java.io.BufferedWriter.flushBuffer()V java.base@22-ea (63 bytes) @ 0x00007f16fd3660f0 [0x00007f16fd366000+0x00000000000000f0]
J 2915 c2 java.io.PrintStream.implWriteln(Ljava/lang/String;)V java.base@22-ea (48 bytes) @ 0x00007f16fd34f3f8 [0x00007f16fd34f320+0x00000000000000d8]
J 2910 c2 java.io.PrintStream.writeln(Ljava/lang/String;)V java.base@22-ea (81 bytes) @ 0x00007f16fd33bc00 [0x00007f16fd33bb80+0x0000000000000080]
J 2744  jdk.internal.vm.Continuation.enterSpecial(Ljdk/internal/vm/Continuation;ZZ)V java.base@22-ea (0 bytes) @ 0x00007f16fd2fb753 [0x00007f16fd2fb5e0+0x0000000000000173]
J 2829 c2 jdk.internal.vm.Continuation.run()V java.base@22-ea (586 bytes) @ 0x00007f16fd332fb4 [0x00007f16fd332a80+0x0000000000000534]
J 2743 c2 java.lang.VirtualThread.runContinuation()V java.base@22-ea (135 bytes) @ 0x00007f16fd2ffcec [0x00007f16fd2ffbc0+0x000000000000012c]
J 2823 c2 java.lang.VirtualThread$$Lambda+0x00007f169f0502d8.run()V java.base@22-ea (8 bytes) @ 0x00007f16fd31258c [0x00007f16fd312540+0x000000000000004c]
J 2821 c2 java.util.concurrent.ForkJoinTask.doExec()I java.base@22-ea (37 bytes) @ 0x00007f16fd3129e0 [0x00007f16fd312960+0x0000000000000080]
J 2820 c2 java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Ljava/util/concurrent/ForkJoinTask;Ljava/util/concurrent/ForkJoinPool$WorkQueue;)V java.base@22-ea (83 bytes) @ 0x00007f16fd31fbf8 [0x00007f16fd31fb60+0x0000000000000098]
J 2814 c2 java.util.concurrent.ForkJoinPool.scan(Ljava/util/concurrent/ForkJoinPool$WorkQueue;II)I java.base@22-ea (263 bytes) @ 0x00007f16fd31b1e0 [0x00007f16fd31afc0+0x0000000000000220]
j  java.util.concurrent.ForkJoinPool.runWorker(Ljava/util/concurrent/ForkJoinPool$WorkQueue;)V+35 java.base@22-ea
J 2807 c2 java.util.concurrent.ForkJoinWorkerThread.run()V java.base@22-ea (180 bytes) @ 0x00007f16fd31d5e8 [0x00007f16fd31d560+0x0000000000000088]
v  ~StubRoutines::call_stub 0x00007f16fcb4dd21

siginfo: si_signo: 8 (SIGFPE), si_code: 1 (FPE_INTDIV), si_addr: 0x00007f17118c7e02


There are a couple of other unresolved bugs related to
serviceability/jvmti/stress/StackTrace/Suspended/GetStackTraceSuspendedStressTest.java

JDK-8310340 assert(_thread->is_interp_only_mode() || stub_caller) failed: expected a stub-caller

JDK-8316397 StackTrace/Suspended/GetStackTraceSuspendedStressTest.java failed with "SingleStep event is NOT expected"
Comments
Closing this as a dup of JDK-8316397. The issues have different manifestations but are about the same issue: SingleStep event is not being expected.
09-05-2024

This is the same failure mode as JDK-8316397. The code raises a SIGFPE to get a core dump, then calls FatalError("SingleStep event is NOT expected"). static void JNICALL SingleStep(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, jlocation location) { RawMonitorLocker rml(jvmti, jni, event_mon); LOG("Agent: Got SingleStep event:\n"); print_stack_trace(jvmti, jni, thread); jthread cthread = get_carrier_thread(jvmti, jni, thread); if (cthread != NULL) { print_stack_trace(jvmti, jni, cthread); } #if 1 i = 1 / (*(&i)); // NOT expected Singlestep event: crash to get full stack trace #endif jni->FatalError("SingleStep event is NOT expected"); } what is odd is that I would expect the SIGFPE to always be handled by the current thread, yet if we get the failure as seen in JDK-8316397 then it implies the signal did not get delivered.
20-10-2023