Message like "[error][cds] Disabling optimized module handling" are printed when a dynamic CDS archive is created on top of the default CDS archive (from the JDK) but specifies extra module parameters.
It's normal for "optimized module handling" to be disabled under this situation. We should not print these messages are errors only if a non-default *static* CDS archive is used.
$ rm /Users/headius/work/jruby/lib/jruby-java25.jsa
$ 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
[.....]
$ 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=org.jruby.dist,java.base/java.nio.channels=org.jruby.dist,java.base/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
See https://mail.openjdk.org/pipermail/leyden-dev/2025-October/002751.html
It's normal for "optimized module handling" to be disabled under this situation. We should not print these messages are errors only if a non-default *static* CDS archive is used.
$ rm /Users/headius/work/jruby/lib/jruby-java25.jsa
$ 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
[.....]
$ 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=org.jruby.dist,java.base/java.nio.channels=org.jruby.dist,java.base/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
See https://mail.openjdk.org/pipermail/leyden-dev/2025-October/002751.html