JDK-8335735 : jruby -J-XX:CacheDataStore=jruby.cds crashes due to lack of module support
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: repo-leyden
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2024-07-05
  • Updated: 2025-04-23
  • Resolved: 2025-04-23
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 25
25Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Sub Tasks
JDK-8336562 :  
Description
https://mail.openjdk.org/pipermail/leyden-dev/2024-July/000760.html

Note the command lines below. jruby specifies these options that are not supported (or sufficiently checked) by the optimizations in the Leyden EA release

    --add-opens=java.base/java.nio.channels=org.jruby.dist 
    --module-path=/xxxx/jruby-9.4.8.0/lib/jruby.jar 

=== reproduce ===
Download and unpack https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.4.8.0/jruby-dist-9.4.8.0-bin.tar.gz

$ cd jruby-9.4.8.0
$ JAVA_HOME=/repo/leyden/build/linux-x64/images/jdk bin/jruby -J-XX:CacheDataStore=jruby.cds -e '10.times { org.jruby.Ruby.newInstance }'
[...]
[3.304s][warning][cds] Skipping jdk/proxy2/$Proxy001027: Unsupported location
[3.304s][warning][cds] Skipping jdk/proxy2/$Proxy001030: Unsupported location
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f6f9cd62eee, pid=1838757, tid=1838758
#
# JRE version: Java(TM) SE Runtime Environment (24.0) (build 24-internal-adhoc.iklam.le3)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24-internal-adhoc.iklam.le3, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x647eee]  ClassPrelinker::is_indy_resolution_deterministic(ConstantPool*, int) [clone .part.0]+0x27e
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/iklam/Downloads/ruby/jruby-9.4.8.0/hs_err_pid1838757.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
Aborted
[4.687s][error  ][cds] Child process finished; status = 134
[4.687s][error  ][cds] To reproduce the error
[4.687s][error  ][cds]     /jdk3/bld/le3/images/jdk/bin/java -cp : --add-opens=java.base/java.io=org.jruby.dist --add-opens=java.base/java.nio.channels=org.jruby.dist --add-opens=java.base/sun.nio.ch=org.jruby.dist --add-opens=java.management/sun.management=org.jruby.dist -Xss2048k -Djffi.boot.library.path=/home/iklam/Downloads/ruby/jruby-9.4.8.0/lib/jni -XX:CacheDataStore=jruby.cds -Djava.security.egd=file:/dev/urandom --module-path=/home/iklam/Downloads/ruby/jruby-9.4.8.0/lib/jruby.jar -Djruby.home=/home/iklam/Downloads/ruby/jruby-9.4.8.0 -Djruby.lib=/home/iklam/Downloads/ruby/jruby-9.4.8.0/lib -Djruby.script=jruby -Djruby.shell=/bin/sh -XX:CDSPreimage=jruby.cds.preimage
Comments
The crash is no longer reproducible with Leyden/premain. I saw the following warning message: [0.001s][warning][cds] optimized module handling/full module graph: disabled due to incompatible property: jdk.module.addopens=java.base/java.io=org.jruby.dist Error occurred during initialization of VM AOT cache cannot be created because AOTClassLinking is enabled but full module graph is disabled The fix for JDK-8352003 allows --add-opens to be specified during creating and using of AOT cache. So closing it as a duplicate.
23-04-2025

Problem: - ClassPreloader doesn't know how to handle classes in user-defined modules, so it just drops them from the preloading list - When --add-opens is specified, the CDS archive becomes unuseable Temporary work around: https://github.com/iklam/jdk/tree/work-around-8335735-jruby-crash-due-to-lack-of-module-support -> https://github.com/iklam/jdk/commit/d9287e9b01a991637bb2c86e7b0425c159cc08bf
05-07-2024