JDK-8276126 : Dump time class transformation causes heap objects of non-boot classes to be archived
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17,18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-10-28
  • Updated: 2021-12-07
  • Resolved: 2021-12-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 18
18 masterFixed
Related Reports
Relates :  
Relates :  
Description
The following assert in HeapShared::init_subgraph_entry_fields() if classes are being transformed using a java agent during dump time:
      assert(InstanceKlass::cast(ik)->is_shared_boot_class(),
             "Only support boot classes");

Stack: [0x00007f6f47128000,0x00007f6f47229000],  sp=0x00007f6f47227930,  free space=1022k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xdcfd54]  HeapShared::init_subgraph_entry_fields(JavaThread*)+0x344
V  [libjvm.so+0x14694ac]  MetaspaceShared::preload_and_dump_impl(JavaThread*)+0x7c
V  [libjvm.so+0x146967b]  MetaspaceShared::preload_and_dump()+0x10b
V  [libjvm.so+0x18bdfad]  Threads::create_vm(JavaVMInitArgs*, bool*)+0x9fd
V  [libjvm.so+0xfb7d88]  JNI_CreateJavaVM+0x98
C  [libjli.so+0x3b3f]  JavaMain+0x8f
C  [libjli.so+0x7d19]  ThreadJavaMain+0x9
Comments
Changeset: d2b16c89 Author: Calvin Cheung <ccheung@openjdk.org> Date: 2021-12-02 14:39:27 +0000 URL: https://git.openjdk.java.net/jdk/commit/d2b16c89855d584a563caa4f725802dc91a83407
02-12-2021

ILW = MLM = P4
02-11-2021

Workaround: don't transform classes loaded by the boot class loader if using java agent during CDS dump.
29-10-2021

To reproduce the bug, expand testcase.tar in your jdk18 repo under open/test/hotspot/jtreg/runtime/cds/appcds and use jtreg to run the LambdaWithJavaAgent.java test. A fix could be to disable heap archiving if bytecode transformation was enabled during dump time.
28-10-2021