JDK-8259036 : Failed JfrVersionSystem invariant when VM built with -fno-elide-constructors
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jfr
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-01-03
  • Updated: 2021-01-26
  • Resolved: 2021-01-19
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 17
17 b06Fixed
Related Reports
Relates :  
Relates :  
Description
If the VM is built with -fno-elide-constructors (for example, by configuring with --with-extra-cxxflags=-fno-elide-constructors), running hotspot:tier1 tests gets the following test failure due to a failed assertion:

compiler/intrinsics/klass/CastNullCheckDroppingsTest.java fails with
#  Internal Error (../../src/hotspot/share/jfr/utilities/jfrVersionSystem.inline.hpp:98), pid=31086, tid=31713
#  assert(node->_live) failed: invariant

This suggests there is a problem with a copy-ctor or assignment operator that is otherwise (without -fno-elide-constructors) optimized away.  We shouldn't be relying on copy elision until C++17 makes it mandatory.

Stack trace for the crash:

Stack: [0x00007fdb172fa000,0x00007fdb173fb000],  sp=0x00007fdb173f8960,  free space=1018k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xf1f0bb]  JfrConcurrentLinkedListHost<JfrConcurrentQueue<JfrBuffer, JfrCHeapObj>, HeadNode, JfrCHeapObj>::insert_tail(JfrBuffer*, JfrBuffer*
, JfrBuffer*, JfrBuffer const*) const+0xeb
V  [libjvm.so+0xfac707]  JfrStorage::initialize()+0x3d7
V  [libjvm.so+0xf95879]  JfrRecorder::create_components()+0x359
V  [libjvm.so+0xf95db2]  JfrRecorder::create(bool)+0x42
V  [libjvm.so+0xf5c0cf]  jfr_create_jfr+0x3df
j  jdk.jfr.internal.JVM.createJFR(Z)Z+0 jdk.jfr@17-internal
j  jdk.jfr.internal.JVM.createNativeJFR()V+3 jdk.jfr@17-internal
j  jdk.jfr.internal.PlatformRecorder.<init>()V+48 jdk.jfr@17-internal
j  jdk.jfr.FlightRecorder.getFlightRecorder()Ljdk/jfr/FlightRecorder;+25 jdk.jfr@17-internal
j  jdk.jfr.Recording.<init>(Ljava/util/Map;)V+14 jdk.jfr@17-internal
j  jdk.jfr.Recording.<init>()V+8 jdk.jfr@17-internal
j  compiler.intrinsics.klass.CastNullCheckDroppingsTest.runTest(Ljava/lang/reflect/Method;ZLjava/lang/Object;)V+27
j  compiler.intrinsics.klass.CastNullCheckDroppingsTest.main([Ljava/lang/String;)V+155
v  ~StubRoutines::call_stub
V  [libjvm.so+0xed9b5e]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x5ae
V  [libjvm.so+0x17c964a]  invoke(InstanceKlass*, methodHandle const&, Handle, bool, objArrayHandle, BasicType, objArrayHandle, bool, Thread*) [clone .constprop.0]+0xfda
V  [libjvm.so+0x17cacaf]  Reflection::invoke_method(oop, Handle, objArrayHandle, Thread*)+0x1bf
V  [libjvm.so+0x10b462f]  JVM_InvokeMethod+0x21f
j  jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@17-internal
j  jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+146 java.base@17-internal
j  jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@17-internal
j  java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@17-internal
j  com.sun.javatest.regtest.agent.MainWrapper$MainThread.run()V+172
j  java.lang.Thread.run()V+11 java.base@17-internal
v  ~StubRoutines::call_stub
V  [libjvm.so+0xed9b5e]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x5ae
V  [libjvm.so+0xeda549]  JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, Thread*)+0x4b9
V  [libjvm.so+0xedaa72]  JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, Thread*)+0xb2
V  [libjvm.so+0x108e5b3]  thread_entry(JavaThread*, Thread*)+0x143
V  [libjvm.so+0x19f91db]  JavaThread::thread_main_inner()+0x40b
V  [libjvm.so+0x1a00080]  Thread::call_run()+0x100
V  [libjvm.so+0x16b0e66]  thread_native_entry(Thread*)+0x116

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  jdk.jfr.internal.JVM.createJFR(Z)Z+0 jdk.jfr@17-internal
j  jdk.jfr.internal.JVM.createNativeJFR()V+3 jdk.jfr@17-internal
j  jdk.jfr.internal.PlatformRecorder.<init>()V+48 jdk.jfr@17-internal
j  jdk.jfr.FlightRecorder.getFlightRecorder()Ljdk/jfr/FlightRecorder;+25 jdk.jfr@17-internal
j  jdk.jfr.Recording.<init>(Ljava/util/Map;)V+14 jdk.jfr@17-internal
j  jdk.jfr.Recording.<init>()V+8 jdk.jfr@17-internal
j  compiler.intrinsics.klass.CastNullCheckDroppingsTest.runTest(Ljava/lang/reflect/Method;ZLjava/lang/Object;)V+27
j  compiler.intrinsics.klass.CastNullCheckDroppingsTest.main([Ljava/lang/String;)V+155
v  ~StubRoutines::call_stub
j  jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@17-internal
j  jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+146 java.base@17-internal
j  jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@17-internal
j  java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@17-internal
j  com.sun.javatest.regtest.agent.MainWrapper$MainThread.run()V+172
j  java.lang.Thread.run()V+11 java.base@17-internal
v  ~StubRoutines::call_stub

Comments
Changeset: 5cfb36e7 Author: Markus Gr��nlund <mgronlun@openjdk.org> Date: 2021-01-19 15:27:22 +0000 URL: https://git.openjdk.java.net/jdk/commit/5cfb36e7
19-01-2021

Note that reproducing this failure requires the fix for JDK-8234773. Without that there is an assertion failure during build with -fno-elide-constructors.
03-01-2021