How to handle errors

ioi.lam at oracle.com ioi.lam at oracle.com
Sun Apr 27 23:18:47 UTC 2025


The second issue (when using graalvm-jdk-24.0.1+9.1) is caused by 
https://bugs.openjdk.org/browse/JDK-8355662

There's a simple work-around: add "--add-modules=jdk.internal.vm.ci" 
when creating the AOT cache. Example:

$ alias java=/home/iklam/graal/graalvm-jdk-24.0.1+9.1/bin/java

$ java -XX:AOTMode=record -XX:AOTConfiguration=hw.aotconfig \
        -cp HelloWorld.jar HelloWorld
$ java --add-modules=jdk.internal.vm.ci -XX:AOTMode=create \
        -XX:AOTConfiguration=hw.aotconfig -XX:AOTCache=hw.aot -cp 
HelloWorld.jar
$ java -XX:AOTCache=hw.aot -cp HelloWorld.jar HelloWorld

Thanks

- Ioi


For the second issue, if you are using graalvm-jdk-24.0.1+9.1, try adding

On 4/25/25 6:50 AM, ski n wrote:
> Thanks, the first issue is the most present issue.
>
> The other one may have happened, because I added an optional argument 
> which wasn't in the training run.
>
> Raymond
>
> On Fri, Apr 25, 2025 at 2:40 PM Dan Heidinga <dan.heidinga at oracle.com> 
> wrote:
>
>     Thanks for reporting the issue.  I see Ioi has run into the same
>     problem with MethodHandleImpl::BindCaller and is putting together
>     a fix in https://bugs.openjdk.org/browse/JDK-8354890
>
>     For the second issue:
>
>     I still got this error and warning:
>
>     [0.026s][error][cds] CDS archive has aot-linked classes. It cannot
>     be used when archived full module graph is not used.
>     [0.017s][warning][cds] shared class paths mismatch (hint: enable
>     -Xlog:class+path=info to diagnose the failure)
>
>     Have you confirmed that the class paths are the same between the
>     assembly phase (-XX:AOTMode=create) and when using the cache? 
>     Confirming the “-Xlog:class+path=info” output from both the
>     assembly and production runs are the same would help.
>
>     --Dan
>
>     *From: *leyden-dev <leyden-dev-retn at openjdk.org> on behalf of ski
>     n <raymondmeester at gmail.com>
>     *Date: *Friday, April 25, 2025 at 4:59 AM
>     *To: *leyden-dev at openjdk.org <leyden-dev at openjdk.org>
>     *Subject: *How to handle errors
>
>     Hi Leyden devs,
>
>     I used CDS before with my Spring Boot application. I recently
>     started to test Leyden with the recent released JDK24.01 (both
>     GraalVM and Temurin). Likewise, I first want to test this
>
>     on my local laptop (Windows 11/intel i7), and try to implement
>     this in my CI/CD to create the cache with a training run, probably
>     with JDK25.
>
>     I run the following commands:
>
>     D:\test\graalvm-jdk-24.0.1+9.1\bin\java -XX:AOTMode=record
>     -XX:AOTConfiguration=app.aotconf -jar gateway-5.1.0.jar
>     D:\test\graalvm-jdk-24.0.1+9.1\bin\java -XX:AOTMode=create
>     -XX:AOTConfiguration=app.aotconf -XX:AOTCache=app.aot -jar
>     gateway-5.1.0.jar
>     D:\test\graalvm-jdk-24.0.1+9.1\bin\java -XX:AOTCache=app.aot -jar
>     gateway-5.1.0.jar
>
>     However, on the second command, I get these warnings/errors:
>
>     D:\test\jdk-24.0.1+9\bin\java -XX:AOTMode=create
>     -XX:AOTConfiguration=app.aotconf -XX:AOTCache=app.aot -jar
>     gateway-5.1.0.jar
>     [0.657s][warning][cds] Skipping jdk/internal/event/Event: JFR
>     event class
>     [1.147s][warning][cds,heap] Archive heap points to a static field
>     that may hold a different value at runtime:
>     [1.148s][warning][cds,heap] Field:
>     java/lang/invoke/MethodHandleImpl$BindCaller::CD_Object_array
>     [1.150s][warning][cds,heap] Value:
>     jdk.internal.constant.ArrayClassDescImpl
>     [1.150s][warning][cds,heap] {0x0000000605959028} - klass:
>     'jdk/internal/constant/ArrayClassDescImpl' - flags:
>     [1.150s][warning][cds,heap]
>     [1.151s][warning][cds,heap]  - ---- fields (total size 3 words):
>     [1.151s][warning][cds,heap]  - private final 'rank' 'I' @12  1
>     (0x00000001)
>     [1.152s][warning][cds,heap]  - private final 'elementType'
>     'Ljava/lang/constant/ClassDesc;' @16  a
>     'jdk/internal/constant/ClassOrInterfaceDescImpl'{0x0000000605914380}
>     (0xc0b22870)
>     [1.152s][warning][cds,heap]  - private 'cachedDescriptorString'
>     'Ljava/lang/String;' @20
>      "[Ljava/lang/Object;"{0x0000000605959040} (0xc0b2b208)
>     [1.152s][warning][cds,heap] --- trace begin ---
>     [1.153s][warning][cds,heap] [ 0] {0x0000000605b73798}
>     java.lang.Class (jdk.internal.constant.ConstantUtils::CD_Object_array)
>     [1.153s][warning][cds,heap] [ 1] {0x0000000605959028}
>     jdk.internal.constant.ArrayClassDescImpl
>     [1.153s][warning][cds,heap] --- trace end ---
>     [1.153s][warning][cds,heap]
>     [1.154s][error  ][cds,heap] Scanned 65968 objects. Found 1 case(s)
>     where an object points to a static field that may hold a different
>     value at runtime.
>     [1.154s][error  ][cds     ] An error has occurred while writing
>     the shared archive file.
>
>     I'm not really sure if this error means I cannot use the cache,
>     but I manually removed the
>     java/lang/invoke/MethodHandleImpl$BindCaller from the AOTCache.
>     After that, I can create the cache and start my application.
>
>     I still got this error and warning:
>
>     [0.026s][error][cds] CDS archive has aot-linked classes. It cannot
>     be used when archived full module graph is not used.
>     [0.017s][warning][cds] shared class paths mismatch (hint: enable
>     -Xlog:class+path=info to diagnose the failure)
>
>     It seems like the cache isn't properly applied, and I don't see a
>     lot of startup time improvement (Is there a way to properly
>     measure the difference between a normal run, and cached run?) I
>     did measure it with timing, and find that cached run seems to be
>     around 2 seconds fastes (from 8 seconds startup to 6 seconds
>     startup). The test jar that I used can be downloaded from GitHub:
>
>     https://github.com/assimbly/gateway/releases/tag/5.1.0Beta
>
>     I am creating the AOTCache properly? And how to mitigate such
>     warnings/errors?
>
>     Raymond
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/leyden-dev/attachments/20250427/0a6bc050/attachment.htm>


More information about the leyden-dev mailing list