JDK-8231606 : _method_ordering is not set during CDS dynamic dump time
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-09-30
  • Updated: 2019-10-09
  • Resolved: 2019-10-02
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 14
14 b18Fixed
Related Reports
Relates :  
Relates :  
Description
The InstanceKlass' _method_ordering is not set during CDS dynamic dump time. This results in the following assert if JDWP option is used during runtime and a debugger is attached to the suspended java process.
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (open/src/hotspot/share/oops/instanceKlass.cpp:3615), pid=32154, tid=32155
#  guarantee(length == methods()->length()) failed: invalid method ordering length

To reproduce:
1. Insert the following JDWP option in the runtime command line with a CDS dynamic archive:
    -Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=y

2. Attach a debugger to the java process, e.g.
    jdb -attach 8888


Comments
Could someone familiar with this issue look at JDK-8232030? I don't understand what CDS has to do with JDWP, or why Graal/JVMCI would be affected.
08-10-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/319173c62caa User: ccheung Date: 2019-10-02 23:56:03 +0000
02-10-2019

The bug could also be reproduced if the "suspend" mode is set to "n" so that the step on attaching a debugger is not required. A fix is in sort_methods() of classFileParser.cpp where the checking of DynamicDumpSharedSpaces condition is missing. bash-4.2$ hg diff src/hotspot/share/classfile/classFileParser.cpp diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -3004,7 +3004,7 @@ // We temporarily use the vtable_index field in the Method* to store the // class file index, so we can read in after calling qsort. // Put the method ordering in the shared archive. - if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) { + if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces || DynamicDumpSharedSpaces) { for (int index = 0; index < length; index++) { Method* const m = methods->at(index); assert(!m->valid_vtable_index(), "vtable index should not be set"); @@ -3018,7 +3018,7 @@ intArray* method_ordering = NULL; // If JVMTI original method ordering or sharing is enabled construct int // array remembering the original ordering - if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) { + if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces || DynamicDumpSharedSpaces) { method_ordering = new intArray(length, length, -1); for (int index = 0; index < length; index++) { Method* const m = methods->at(index);
01-10-2019