JDK-8278053 : serviceability/jvmti/vthread/ContStackDepthTest/ContStackDepthTest.java failing in loom repo with Xcomp
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 19,repo-loom
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-12-01
  • Updated: 2022-07-27
  • Resolved: 2022-06-21
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 19 JDK 20
19 b28Fixed 20Fixed
Related Reports
Relates :  
Description
loom repo, tier4. This test fails intermittently with:

#  Internal Error (<top>/workspace/open/src/hotspot/share/prims/jvmtiThreadState.cpp:601), pid=11953, tid=12203
#  assert(_cur_stack_depth == num_frames) failed: cur_stack_depth out of sync _cur_stack_depth: 14 num_frames: 18

With -Xcomp runs it seems to fail more frequently, the stack trace is the same:

Stack: [0x00007fc964b85000,0x00007fc964c86000],  sp=0x00007fc964c840b0,  free space=1020k
Thread 0x00007fc9743a5150 [9507]
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x11cacdc]  JvmtiThreadState::decr_cur_stack_depth()+0xdc
V  [libjvm.so+0x118d5c0]  JvmtiExport::post_method_exit_inner(JavaThread*, methodHandle&, JvmtiThreadState*, bool, frame, jvalue&)+0x210
V  [libjvm.so+0x11906bb]  JvmtiExport::post_method_exit(JavaThread*, Method*, frame)+0x1fb
V  [libjvm.so+0xec0d61]  InterpreterRuntime::post_method_exit(JavaThread*)+0x91
j  jdk.internal.vm.Continuation.enter0()V+9 java.base@19-internal
j  jdk.internal.vm.Continuation.enter(Ljdk/internal/vm/Continuation;Z)V+1 java.base@19-internal
J 3648  jdk.internal.vm.Continuation.enterSpecial(Ljdk/internal/vm/Continuation;Z)V java.base@19-internal (0 bytes) @ 0x00007fc969e017e9 [0x00007fc969e01760+0x0000000000000089]
j  jdk.internal.vm.Continuation.run()V+117 java.base@19-internal
j  ContFramePopTest.runTest()V+43
j  ContFramePopTest.main([Ljava/lang/String;)V+49
J 3149 c2 java.lang.invoke.LambdaForm$DMH+0x0000000801002000.invokeStatic(Ljava/lang/Object;Ljava/lang/Object;)V java.base@19-internal (14 bytes) @ 0x00007fc969ccced8 [0x00007fc969ccce80+0x0000000000000058]
J 3206 c2 java.lang.invoke.LambdaForm$MH+0x0000000801003400.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; java.base@19-internal (38 bytes) @ 0x00007fc969d36170 [0x00007fc969d360a0+0x00000000000000d0]
J 3207 c2 java.lang.invoke.Invokers$Holder.invokeExact_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; java.base@19-internal (24 bytes) @ 0x00007fc969d3bab8 [0x00007fc969d3b960+0x0000000000000158]
j  jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+55 java.base@19-internal
j  jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+23 java.base@19-internal
J 1132 c2 java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; java.base@19-internal (108 bytes) @ 0x00007fc96992f3c0 [0x00007fc96992f120+0x00000000000002a0]
j  com.sun.javatest.regtest.agent.MainWrapper$MainThread.run()V+172
J 3104 c2 java.lang.Thread.run()V java.base@19-internal (26 bytes) @ 0x00007fc969ce20e8 [0x00007fc969ce2060+0x0000000000000088]
v  ~StubRoutines::call_stub 0x00007fc9695a5d4a
V  [libjvm.so+0xed30c7]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x4e7
V  [libjvm.so+0xed39ec]  JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x26c
V  [libjvm.so+0xed3af7]  JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, JavaThread*)+0x77
V  [libjvm.so+0x1004c99]  thread_entry(JavaThread*, JavaThread*)+0x89
V  [libjvm.so+0x174d3ca]  JavaThread::thread_main_inner()+0x1ea
V  [libjvm.so+0x1754990]  Thread::call_run()+0x100
V  [libjvm.so+0x1492844]  thread_native_entry(Thread*)+0x104
Comments
Changeset: 97200a78 Author: Ron Pressler <rpressler@openjdk.org> Committer: Serguei Spitsyn <sspitsyn@openjdk.org> Date: 2022-06-21 16:48:33 +0000 URL: https://git.openjdk.org/jdk19/commit/97200a78b176ccc8781acb67db2af2f62572d46a
21-06-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk19/pull/12 Date: 2022-06-14 08:02:21 +0000
14-06-2022

The assertion is still in place for debug builds. The problem is that method exit is not generated for jdk/internal/vm/Continuation.yield after yield0 So the cur_stack_depth is incorrect. Note that it should not affect JDK users, because all these methods don't work inside of virtual threads because of transitions. So might be need to see how the same scenario is tested with virtual threads. To test that cur_stack_depth is correctly synced when the virtual thread is used.
09-06-2022

FYI the assert has been removed. I didn't realize that it was still detecting issues, and it's something that long ago we decided we did not want in jdk due to performance concerns. So you'll need to re-add it to reproduce this problem.
22-04-2022

This happens in the context of the indy bootstrap method execution. The JvmtiExport::post_method_exit() is triggered by return from Java method: java.lang.Object.<init>() This is for post-19-integration.
20-04-2022

This bug is reproducible. Here is the hs_err dump: # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (/scratch/sspitsyn/loom5/open/src/hotspot/share/prims/jvmtiThreadState.cpp:628), pid=21241, tid=23984 # assert(_cur_stack_depth == num_frames) failed: cur_stack_depth out of sync _cur_stack_depth: 22 num_frames: 21 # # JRE version: Java(TM) SE Runtime Environment (19.0) (fastdebug build 19-internal-2022-04-16-0209416.sspitsyn...) # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 19-internal-2022-04-16-0209416.sspitsyn..., compiled mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64) # Problematic frame: # V [libjvm.so+0x1392524] JvmtiThreadState::cur_stack_depth()+0xc4 # # Core dump will be written. Default location: /scratch/sspitsyn/tst/loom5/JTwork/scratch/core.21241 # # If you would like to submit a bug report, please visit: # https://bugreport.java.com/bugreport/crash.jsp # --------------- S U M M A R Y ------------ Command Line: -Dtest.vm.opts=-Xcomp -XX:-VerifyContinuations -XX:+CheckUnhandledOops -Xcheck:jni -Dtest.tool.vm.opts=-J-Xcomp -J-XX:-VerifyContinuations -J-XX:+CheckUnhandledOops -J-Xcheck:jni -Dtest.compiler.opts= -Dtest.java.opts= -Dtest.jdk=/scratch/sspitsyn/loom5/build/linux-x64-debug/images/jdk -Dcompile.jdk=/scratch/sspitsyn/loom5/build/linux-x64-debug/images/jdk -Dtest.timeout.factor=1.0 -Dtest.nativepath=/scratch/sspitsyn/loom5/build/linux-x64-debug/images/test/hotspot/jtreg/native -Dtest.root=/scratch/sspitsyn/loom5/open/test/hotspot/jtreg -Dtest.name=serviceability/jvmti/vthread/ContStackDepthTest/ContStackDepthTest.java -Dtest.file=/scratch/sspitsyn/loom5/open/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/ContStackDepthTest.java -Dtest.src=/scratch/sspitsyn/loom5/open/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest -Dtest.src.path=/scratch/sspitsyn/loom5/open/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest -Dtest.classes=/scratch/sspitsyn/tst/loom5/JTwork/classes/serviceability/jvmti/vthread/ContStackDepthTest/ContStackDepthTest.d -Dtest.class.path=/scratch/sspitsyn/tst/loom5/JTwork/classes/serviceability/jvmti/vthread/ContStackDepthTest/ContStackDepthTest.d -Dtest.modules=java.base/jdk.internal.vm --add-modules=java.base --add-exports=java.base/jdk.internal.vm=ALL-UNNAMED -Xcomp -XX:-VerifyContinuations -XX:+CheckUnhandledOops -Xcheck:jni -Djava.library.path=/scratch/sspitsyn/loom5/build/linux-x64-debug/images/test/hotspot/jtreg/native --enable-preview -agentlib:ContStackDepthTest com.sun.javatest.regtest.agent.MainWrapper /scratch/sspitsyn/tst/loom5/JTwork/serviceability/jvmti/vthread/ContStackDepthTest/ContStackDepthTest.d/main.1.jta Host: hotspot-oraclelinux-01, Intel(R) Xeon(R) Platinum 8167M CPU @ 2.00GHz, 32 cores, 235G, Oracle Linux Server release 7.8 Time: Wed Apr 20 20:14:45 2022 GMT elapsed time: 37.864246 seconds (0d 0h 0m 37s) --------------- T H R E A D --------------- Current thread (0x00007feef833fb50): JavaThread "MainThread" [_thread_in_vm, id=23984, stack(0x00007fee797bb000,0x00007fee798bc000)] Stack: [0x00007fee797bb000,0x00007fee798bc000], sp=0x00007fee798b9280, free space=1016k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x1392524] JvmtiThreadState::cur_stack_depth()+0xc4 V [libjvm.so+0x134cec9] JvmtiExport::post_method_exit_inner(JavaThread*, methodHandle&, JvmtiThreadState*, bool, frame, jvalue&) [clone .part.0]+0xb9 V [libjvm.so+0x135041e] JvmtiExport::post_method_exit(JavaThread*, Method*, frame)+0x1ae V [libjvm.so+0xfc740b] InterpreterRuntime::post_method_exit(JavaThread*)+0xbb j java.lang.Object.<init>()V+0 java.base@19-internal j java.lang.invoke.MethodType.<init>(Ljava/lang/Class;[Ljava/lang/Class;)V+1 java.base@19-internal j java.lang.invoke.MethodType.makeImpl(Ljava/lang/Class;[Ljava/lang/Class;Z)Ljava/lang/invoke/MethodType;+17 java.base@19-internal j java.lang.invoke.MethodHandleNatives.findMethodHandleType(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/invoke/MethodType;+3 java.base@19-internal v ~StubRoutines::call_stub 0x00007feee6dd0d47 V [libjvm.so+0xfdd554] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x504 V [libjvm.so+0xfde708] JavaCalls::call_static(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x318 V [libjvm.so+0x19f03f2] SystemDictionary::find_method_handle_type(Symbol*, Klass*, JavaThread*)+0xfc2 V [libjvm.so+0x7605e8] BootstrapInfo::resolve_bss_name_and_type(JavaThread*)+0xd8 V [libjvm.so+0x766f03] BootstrapInfo::resolve_bsm(JavaThread*)+0x1183 V [libjvm.so+0x19f2c4e] SystemDictionary::invoke_bootstrap_method(BootstrapInfo&, JavaThread*)+0x4e V [libjvm.so+0x1407965] LinkResolver::resolve_dynamic_call(CallInfo&, BootstrapInfo&, JavaThread*)+0x25 V [libjvm.so+0x1407ec6] LinkResolver::resolve_invokedynamic(CallInfo&, constantPoolHandle const&, int, JavaThread*)+0x136 V [libjvm.so+0xfc99aa] InterpreterRuntime::resolve_invokedynamic(JavaThread*)+0x26a V [libjvm.so+0xfce810] InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code)+0x1a0 j ContStackDepthTest.lambda$static$0()V+21 J 5765 jdk.internal.vm.Continuation.enterSpecial(Ljdk/internal/vm/Continuation;ZZ)V java.base@19-internal (0 bytes) @ 0x00007feee7bbc355 [0x00007feee7bbc2c0+0x0000000000000095] j jdk.internal.vm.Continuation.run()V+152 java.base@19-internal j ContStackDepthTest.getNextFib()Ljava/math/BigInteger;+3 j ContStackDepthTest.fibTest()V+41 J 5435 c1 ContStackDepthTest.main([Ljava/lang/String;)V (79 bytes) @ 0x00007feedfa9a594 [0x00007feedfa9a280+0x0000000000000314] J 5441 c1 java.lang.invoke.LambdaForm$DMH+0x0000000801002400.invokeStatic(Ljava/lang/Object;Ljava/lang/Object;)V java.base@19-internal (14 bytes) @ 0x00007feedfb0e7d4 [0x00007feedfb0e3c0+0x0000000000000414] J 5574 c1 java.lang.invoke.LambdaForm$MH+0x0000000801003800.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; java.base@19-internal (38 bytes) @ 0x00007feedfac5714 [0x00007feedfac5120+0x00000000000005f4] J 5577 c1 java.lang.invoke.Invokers$Holder.invokeExact_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; java.base@19-internal (24 bytes) @ 0x00007feedfbac15c [0x00007feedfbab9e0+0x000000000000077c] j jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+55 java.base@19-internal j jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+23 java.base@19-internal J 2920 c2 java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; java.base@19-internal (108 bytes) @ 0x00007feee78cf658 [0x00007feee78cf380+0x00000000000002d8] J 5281 c1 com.sun.javatest.regtest.agent.MainWrapper$MainThread.run()V (476 bytes) @ 0x00007feedfb8eecc [0x00007feedfb8d660+0x000000000000186c] J 5277 c1 java.lang.Thread.run()V java.base@19-internal (19 bytes) @ 0x00007feedfa858c4 [0x00007feedfa85720+0x00000000000001a4] v ~StubRoutines::call_stub 0x00007feee6dd0d47 V [libjvm.so+0xfdd554] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x504 V [libjvm.so+0xfdde04] JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x4b4 V [libjvm.so+0xfde277] JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, JavaThread*)+0x77 V [libjvm.so+0x1159c4b] thread_entry(JavaThread*, JavaThread*)+0x12b V [libjvm.so+0x1a5717a] JavaThread::thread_main_inner()+0x21a V [libjvm.so+0x1a64a10] Thread::call_run()+0x100 V [libjvm.so+0x1710274] thread_native_entry(Thread*)+0x104
20-04-2022

serviceability/jvmti/vthread/ContFramePopTest/ContFramePopTest.java is also failing, several sightings in tier7. Here's one: https://mach5.us.oracle.com:10060/api/v1/results/albatem-loom-20220129-1133-28618637-tier7-comp-open_test_hotspot_jtreg_hotspot_serviceability-linux-x64-debug-95-1643459819-191/log https://mach5.us.oracle.com:10060/api/v1/results/albatem-loom-20220129-1133-28618637-tier7-comp-open_test_hotspot_jtreg_hotspot_serviceability-linux-x64-debug-95-1643459819-191/artifacts/hs_err_pid2156414.log
29-01-2022