JDK-8064571 : java/lang/instrument/IsModifiableClassAgent.java: assert(length > 0) failed: should only be called if table is present
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-11-11
  • Updated: 2017-07-26
  • Resolved: 2014-11-14
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 9
9 b42Fixed
Related Reports
Relates :  
Description
#section:main
----------messages:(3/211)----------
command: main -javaagent:IsModifiableClassAgent.jar IsModifiableClassApp
reason: User specified action: run main/othervm -javaagent:IsModifiableClassAgent.jar IsModifiableClassApp 
elapsed time (seconds): 0.885
----------System.out:(21/1154)----------
IsModifiableClassAgent started
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/constMethod.cpp:296
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/jprt/T/P1/005237.emccorkl/s/hotspot/src/share/vm/oops/constMethod.cpp:296), pid=27691, tid=4152064880
#  assert(length > 0) failed: should only be called if table is present
#
# JRE version: Java(TM) SE Runtime Environment (9.0) (build 1.9.0-internal-fastdebug-201411110052.emccorkl.hotspot-b00)
# Java VM: Java HotSpot(TM) Client VM (1.9.0-internal-fastdebug-201411110052.emccorkl.hotspot-b00 mixed mode linux-x86 )
# Core dump written. Default location: /scratch/local/aurora/sandbox/results/workDir/java/lang/instrument/IsModifiableClassAgent/core or core.27691
#
# An error report file with more information is saved as:
# /scratch/local/aurora/sandbox/results/workDir/java/lang/instrument/IsModifiableClassAgent/hs_err_pid27691.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
Current thread is 4152064880
Dumping core ...
----------System.err:(0/0)----------
----------rerun:(19/1920)*----------



RULE java/lang/instrument/IsModifiableClassAgent.java Crash Internal Error ...constMethod.cpp...assert(length > ...) failed: should only be called if table is present

Comments
Root cause: JDK-8058313 missed converting a ">" to a ">=" in an assert. Also, this case only arises with zero-length MethodParameters attributes. Thus, does not arise in classfiles produced by javac; as it will not emit a zero-length MethodParameters attribute.
13-11-2014

Regression was introduced by this change: changeset: 7343:425d09fb378b user: emc date: Mon Nov 10 16:45:46 2014 -0500 files: src/share/vm/classfile/classFileParser.cpp src/share/vm/oops/constMethod.cpp src/share/vm/oops/constMethod.hpp src/share/vm/prims/jvm.cpp description: 8058313: Mismatch of method descriptor and MethodParameters.parameters_count should cause MalformedParameterException Summary: Allow hotspot to store and report zero-length MethodParameters attribute data Reviewed-by: coleenp, jiangli
11-11-2014

One of the crashes shows this stack trace: --------------- T H R E A D --------------- Current thread (0xf640a800): JavaThread "main" [_thread_in_vm, id=27078, stack(0xf779e000,0xf77ef000)] Stack: [0xf779e000,0xf77ef000], sp=0xf77eca70, free space=314k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0xaa20d8] VMError::report_and_die()+0x198;; VMError::report_and_die()+0x198 V [libjvm.so+0x3d0696] report_vm_error(char const*, int, char const*, char const*)+0x76;; report_vm_error(char const*, int, char const*, char const*)+0x76 V [libjvm.so+0x3ba8fe] ConstMethod::method_parameters_start() const+0x7e;; ConstMethod::method_parameters_start() const+0x7e V [libjvm.so+0x76c240] VM_RedefineClasses::rewrite_cp_refs_in_method(methodHandle, methodHandle*, Thread*)+0xb70;; VM_RedefineClasses::rewrite_cp_refs_in_method(methodHandle, methodHandle*, Thread*)+0xb70 V [libjvm.so+0x76c873] VM_RedefineClasses::rewrite_cp_refs_in_methods(instanceKlassHandle, Thread*)+0x313;; VM_RedefineClasses::rewrite_cp_refs_in_methods(instanceKlassHandle, Thread*)+0x313 V [libjvm.so+0x778bdf] VM_RedefineClasses::rewrite_cp_refs(instanceKlassHandle, Thread*)+0x3f;; VM_RedefineClasses::rewrite_cp_refs(instanceKlassHandle, Thread*)+0x3f V [libjvm.so+0x77947d] VM_RedefineClasses::merge_cp_and_rewrite(instanceKlassHandle, instanceKlassHandle, Thread*)+0x62d;; VM_RedefineClasses::merge_cp_and_rewrite(instanceKlassHandle, instanceKlassHandle, Thread*)+0x62d V [libjvm.so+0x7798ec] VM_RedefineClasses::load_new_class_versions(Thread*)+0x21c;; VM_RedefineClasses::load_new_class_versions(Thread*)+0x21c V [libjvm.so+0x77b182] VM_RedefineClasses::doit_prologue()+0xb2;; VM_RedefineClasses::doit_prologue()+0xb2 V [libjvm.so+0xac9210] VMThread::execute(VM_Operation*)+0x470;; VMThread::execute(VM_Operation*)+0x470 V [libjvm.so+0x7375d0] JvmtiEnv::RetransformClasses(int, _jclass* const*)+0x320;; JvmtiEnv::RetransformClasses(int, _jclass* const*)+0x320 V [libjvm.so+0x6b98bf] jvmti_RetransformClasses+0x12f;; jvmti_RetransformClasses+0x12f C [libinstrument.so+0x4a54] retransformClasses+0x244;; retransformClasses+0x244 C [libinstrument.so+0x181b] Java_sun_instrument_InstrumentationImpl_retransformClasses0+0x2b;; Java_sun_instrument_InstrumentationImpl_retransformClasses0+0x2b j sun.instrument.InstrumentationImpl.retransformClasses0(J[Ljava/lang/Class;)V+0 j sun.instrument.InstrumentationImpl.retransformClasses([Ljava/lang/Class;)V+23 j IsModifiableClassAgent.premain(Ljava/lang/String;Ljava/lang/instrument/Instrumentation;)V+142 v ~StubRoutines::call_stub Since the test is for JLI and RedefineClasses() is in use, this should start in hotspot/jvmti for initial triage.
11-11-2014