AppCDS in 25 failing for JRuby command line

ioi.lam at oracle.com ioi.lam at oracle.com
Thu Oct 2 22:47:56 UTC 2025


Hi Charlie,


> [] jdk25 $ rm /Users/headius/work/jruby/lib/jruby-java25.jsa
> [] jdk25 $ 
> /Library/Java/JavaVirtualMachines/zulu-25.jdk/Contents/Home/bin/java 
> @/Users/headius/work/jruby/bin/.jruby.java_opts 
> @/Users/headius/work/jruby/bin/.jruby.module_opts -Xss2048k 
> -Djffi.boot.library.path=/Users/headius/work/jruby/lib/jni 
> -Djava.security.egd=file:/dev/urandom -XX:+AutoCreateSharedArchive 
> -XX:SharedArchiveFile=/Users/headius/work/jruby/lib/jruby-java25.jsa 
> --enable-native-access=org.jruby.dist 
> --sun-misc-unsafe-memory-access=allow --module-path 
> /Users/headius/work/jruby/lib/jruby.jar -classpath : 
> -Djruby.home=/Users/headius/work/jruby 
> -Djruby.lib=/Users/headius/work/jruby/lib -Djruby.script=jruby 
> -Djruby.shell=/bin/sh org.jruby.Main -e 1

The problem here is -XX:+AutoCreateSharedArchive is for creating a 
dynamic CDS archive, which runs on top of the static CDS archive that 
comes with the JDK.

The archived module graph is created only for the static CDS archive (or 
JEP 483 AOT cache). It's not created for the dynamic CDS archive. This 
is because the archived module graph requires the archiving of Java heap 
objects, which is not supported by the dynamic archive.

The errors you saw basically meant that because different parameters 
were given for --module-path, --enable-native-access, etc, than those 
used when we created the default CDS archive, we are not able to use the 
archived module graph.

This is a performance regression from JDK 24, as the archived module 
graph would have also been disabled with JDK 24.

However, in JDK 25, we changed the logging of these messages so they are 
now printed in the "error" channel. This is a bug. I have created 
https://bugs.openjdk.org/browse/JDK-8369079 and will try to backport the 
fix to JDK 25u.

Meanwhile, you can add -Xlog:cds=none to disable these logs.

A better alternative would be to use the AOT cache. It will have faster 
start-up time, and it will store an archived module graph that matches 
your command-line settings.


Thanks

- Ioi


On 10/2/25 10:09 AM, Charles Oliver Nutter wrote:
> Full output as a gist: 
> https://gist.github.com/headius/88d91118ef1487b4fbff357fecf06904
>
> On Thu, Oct 2, 2025 at 12:03 PM Charles Oliver Nutter 
> <headius at headius.com> wrote:
>
>     Here's the full -Xlog:aot,cds output. Nothing jumps out at me. It
>     seems to be confused about which modules are specified at dump
>     time, even though the same command line sees those modules at
>     runtime.
>
>     [0.010s][info][cds] trying to map
>     /Library/Java/JavaVirtualMachines/zulu-25.jdk/Contents/Home/lib/server/classes.jsa
>     [0.010s][info][cds] Opened shared archive file
>     /Library/Java/JavaVirtualMachines/zulu-25.jdk/Contents/Home/lib/server/classes.jsa.
>     [0.010s][info][cds] The shared archive file was created with
>     UseCompressedOops = 1, UseCompressedClassPointers = 1,
>     UseCompactObjectHeaders = 0
>     [0.010s][info][cds] Core region alignment: 16384
>     [0.010s][info][cds] trying to map
>     /Users/headius/work/jruby/lib/jruby-java25.jsa
>     [0.010s][info][cds] Opened shared archive file
>     /Users/headius/work/jruby/lib/jruby-java25.jsa.
>     [0.010s][info][cds] The shared archive file was created with
>     UseCompressedOops = 1, UseCompressedClassPointers = 1,
>     UseCompactObjectHeaders = 0
>     [0.010s][info][cds] optimized module handling: disabled because
>     archive was created without optimized module handling
>     [0.010s][info][cds] ArchiveRelocationMode: 1
>     [0.010s][info][cds] ArchiveRelocationMode == 1: always map
>     archive(s) at an alternative address
>     [0.010s][info][cds] Try to map archive(s) at an alternative address
>     [0.010s][info][cds] Reserved archive_space_rs [0x0000000f00000000
>     - 0x0000000f03000000] (50331648) bytes (includes protection zone)
>     [0.010s][info][cds] Reserved class_space_rs [0x0000000f03000000 -
>     0x0000000f43000000] (1073741824) bytes
>     [0.010s][info][cds] Mapped static  region #0 at base
>     0x0000000f00004000 top 0x0000000f004b0000 (ReadWrite)
>     [0.010s][info][cds] Mapped static  region #1 at base
>     0x0000000f004b0000 top 0x0000000f00d94000 (ReadOnly)
>     [0.010s][info][cds] Mapped static  region #2 at base
>     0x00000001009d8000 top 0x0000000100a0c000 (Bitmap)
>     [0.020s][error][cds] An error has occurred while processing the
>     shared archive file. Run with -Xlog:aot,cds for details.
>     [0.020s][error][cds] optimized module handling: disabled because
>     extra module path(s) are specified
>     [0.020s][info ][cds] archived module property jdk.module.main: (null)
>     [0.020s][info ][cds] archived module property
>     jdk.module.addexports: (null)
>     [0.020s][info ][cds] archived module property jdk.module.addmods:
>     (null)
>     [0.020s][info ][cds] archived module property
>     jdk.module.enable.native.access: (null)
>     [0.020s][error][cds] Mismatched values for property
>     jdk.module.enable.native.access: org.jruby.dist specified during
>     runtime but not during dump time
>     [0.020s][error][cds] Disabling optimized module handling
>     [0.020s][info ][cds] archived module property jdk.module.addopens:
>     (null)
>     [0.020s][error][cds] Mismatched values for property
>     jdk.module.addopens: java.base/java.io
>     <http://java.io>=org.jruby.dist,java.base/java.nio.channels=org.jruby.dist,java.base/sun.nio.ch
>     <http://sun.nio.ch>=org.jruby.dist,java.management/sun.management=org.jruby.dist
>     specified during runtime but not during dump time
>     [0.020s][error][cds] Disabling optimized module handling
>     [0.020s][info ][cds] archived module property jdk.module.addreads:
>     (null)
>     [0.020s][info ][cds] optimized module handling: disabled
>     [0.020s][info ][cds] full module graph: disabled
>     [0.021s][info ][cds] Mapped dynamic region #0 at base
>     0x0000000f00d94000 top 0x0000000f01a80000 (ReadWrite)
>     [0.021s][info ][cds] Mapped dynamic region #1 at base
>     0x0000000f01a80000 top 0x0000000f02b4c000 (ReadOnly)
>     [0.021s][info ][cds] Mapped dynamic region #2 at base
>     0x0000000101a8c000 top 0x0000000101afc000 (Bitmap)
>     [0.025s][info ][cds] CDS archive was created with max heap size =
>     128M, and the following configuration:
>     [0.025s][info ][cds]     narrow_klass_base at mapping start
>     address, narrow_klass_pointer_bits = 32, narrow_klass_shift = 0
>     [0.025s][info ][cds]     narrow_oop_mode = 1, narrow_oop_base =
>     0x0000000000000000, narrow_oop_shift = 3
>     [0.025s][info ][cds] The current max heap size = 6144M,
>     G1HeapRegion::GrainBytes = 4194304
>     [0.025s][info ][cds]     narrow_klass_base = 0x0000000f00000000,
>     arrow_klass_pointer_bits = 32, narrow_klass_shift = 0
>     [0.025s][info ][cds]     narrow_oop_mode = 1, narrow_oop_base =
>     0x0000000000000000, narrow_oop_shift = 3
>     [0.025s][info ][cds]     heap range = [0x0000000680000000 -
>     0x0000000800000000]
>     [0.025s][info ][cds] Preferred address to map heap data (to avoid
>     relocation) is 0x00000007ffe00000
>     [0.025s][info ][cds] Heap data mapped at 0x00000007ffc00000, size
>     =  1177848 bytes
>     [0.025s][info ][cds] CDS heap data relocation delta = -2097152 bytes
>     [0.025s][info ][aot] initial optimized module handling: disabled
>     [0.025s][info ][aot] initial full module graph: disabled
>     [0.025s][info ][aot] patching heap embedded pointers: narrowOop
>     0xfffc0000 -> 0xfff80000
>     [0.025s][info ][aot] heap data relocation quick delta = 0xfffc0000
>     [0.027s][info ][cds] Unmapping region #2 at base
>     0x00000001009d8000 (Bitmap)
>     [0.027s][info ][cds] Unmapping region #2 at base
>     0x0000000101a8c000 (Bitmap)
>     [0.027s][info ][aot] Using AOT-linked classes: false (static
>     archive: no aot-linked classes, dynamic archive: no aot-linked
>     classes)
>
>     On Thu, Oct 2, 2025 at 11:58 AM Charles Oliver Nutter
>     <headius at headius.com> wrote:
>
>         Hello friends!
>
>         I was doing some testing of AppCDS on JDK 25, in hopes of
>         having our Docker images pre-generate an AppCDS archive. But I
>         discovered an issue... AppCDS does not appear to like the
>         JRuby command line anymore in JDK 25.
>
>         Here's part of a session where I delete the old AppCDS archive
>         and then run the same command line twice
>         with AutoCreateSharedArchive. The archive generates ok in the
>         first command, but then is rejected by the second command:
>
>         [] jdk25 $ rm /Users/headius/work/jruby/lib/jruby-java25.jsa
>         [] jdk25 $
>         /Library/Java/JavaVirtualMachines/zulu-25.jdk/Contents/Home/bin/java
>         @/Users/headius/work/jruby/bin/.jruby.java_opts
>         @/Users/headius/work/jruby/bin/.jruby.module_opts -Xss2048k
>         -Djffi.boot.library.path=/Users/headius/work/jruby/lib/jni
>         -Djava.security.egd=file:/dev/urandom
>         -XX:+AutoCreateSharedArchive
>         -XX:SharedArchiveFile=/Users/headius/work/jruby/lib/jruby-java25.jsa
>         --enable-native-access=org.jruby.dist
>         --sun-misc-unsafe-memory-access=allow --module-path
>         /Users/headius/work/jruby/lib/jruby.jar -classpath :
>         -Djruby.home=/Users/headius/work/jruby
>         -Djruby.lib=/Users/headius/work/jruby/lib -Djruby.script=jruby
>         -Djruby.shell=/bin/sh org.jruby.Main -e 1
>         [1.074s][warning][cds] Skipping jdk/proxy2/$Proxy13:
>         Unsupported location
>         [1.074s][warning][cds] Skipping jdk/proxy2/$Proxy25:
>         Unsupported location
>         [1.074s][warning][cds] Skipping
>         org/joda/time/field/MillisDurationField: Old class has been linked
>         ...
>         [1.076s][warning][cds] Skipping
>         org/jruby/org/objectweb/asm/ClassWriter: Old class has been linked
>         [1.076s][warning][cds] Skipping
>         org/joda/time/format/DateTimeFormatterBuilder$PaddedNumber:
>         Old class has been linked
>         [] jdk25 $
>         /Library/Java/JavaVirtualMachines/zulu-25.jdk/Contents/Home/bin/java
>         @/Users/headius/work/jruby/bin/.jruby.java_opts
>         @/Users/headius/work/jruby/bin/.jruby.module_opts -Xss2048k
>         -Djffi.boot.library.path=/Users/headius/work/jruby/lib/jni
>         -Djava.security.egd=file:/dev/urandom
>         -XX:+AutoCreateSharedArchive
>         -XX:SharedArchiveFile=/Users/headius/work/jruby/lib/jruby-java25.jsa
>         --enable-native-access=org.jruby.dist
>         --sun-misc-unsafe-memory-access=allow --module-path
>         /Users/headius/work/jruby/lib/jruby.jar -classpath :
>         -Djruby.home=/Users/headius/work/jruby
>         -Djruby.lib=/Users/headius/work/jruby/lib -Djruby.script=jruby
>         -Djruby.shell=/bin/sh org.jruby.Main -e 1
>         [0.008s][error][cds] An error has occurred while processing
>         the shared archive file. Run with -Xlog:aot,cds for details.
>         [0.008s][error][cds] optimized module handling: disabled
>         because extra module path(s) are specified
>         [0.008s][error][cds] Mismatched values for property
>         jdk.module.enable.native.access: org.jruby.dist specified
>         during runtime but not during dump time
>         [0.008s][error][cds] Disabling optimized module handling
>         [0.008s][error][cds] Mismatched values for property
>         jdk.module.addopens: java.base/java.io
>         <http://java.io>=org.jruby.dist,java.base/java.nio.channels=org.jruby.dist,java.base/sun.nio.ch
>         <http://sun.nio.ch>=org.jruby.dist,java.management/sun.management=org.jruby.dist
>         specified during runtime but not during dump time
>         [0.008s][error][cds] Disabling optimized module handling
>
>         The errors make no sense because I'm doing exactly the same
>         thing in both command lines.
>
>         Here's the contents of the
>         /Users/headius/work/jruby/bin/.jruby.module_opts file (the
>         .jruby.java_opts file is empty):
>
>         --add-opens java.base/java.io <http://java.io>=org.jruby.dist
>         --add-opens java.base/java.nio.channels=org.jruby.dist
>         --add-opens java.base/sun.nio.ch
>         <http://sun.nio.ch>=org.jruby.dist
>         --add-opens java.management/sun.management=org.jruby.dist
>
>         Running the same commands against JDK 21 works just fine...
>         the jsa file is generated and used correctly. Is there
>         something I'm doing wrong with this command line that JDK 25
>         does not like?
>
>         I can re-test with another JDK if necessary. Let me know if I
>         should open a bug for this.
>
>         Reproduce by downloading JRuby from https://jruby.org and
>         unpacking. It runs out of the box.
>
>         *Charles Oliver Nutter*
>         /Architect and Technologist/
>         Headius Enterprises
>         https://www.headius.com
>         headius at headius.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/leyden-dev/attachments/20251002/2862913f/attachment.htm>


More information about the leyden-dev mailing list