<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><font face="monospace">The second issue (when using
graalvm-jdk-24.0.1+9.1) is caused by
<a class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8355662">https://bugs.openjdk.org/browse/JDK-8355662</a><br>
</font></p>
<p><font face="monospace">There's a simple work-around: add
"--add-modules=jdk.internal.vm.ci" when creating the AOT cache.
Example:</font></p>
<p><font face="monospace">$ alias
java=/home/iklam/graal/graalvm-jdk-24.0.1+9.1/bin/java</font></p>
<p><font face="monospace">$ java -XX:AOTMode=record
-XX:AOTConfiguration=hw.aotconfig \<br>
-cp HelloWorld.jar HelloWorld<br>
$ java --add-modules=jdk.internal.vm.ci -XX:AOTMode=create \<br>
-XX:AOTConfiguration=hw.aotconfig -XX:AOTCache=hw.aot -cp
HelloWorld.jar<br>
$ java -XX:AOTCache=hw.aot -cp HelloWorld.jar HelloWorld<br>
</font></p>
<p><font face="monospace">Thanks</font></p>
<p><font face="monospace">- Ioi<br>
</font></p>
<p><font face="monospace"><br>
</font></p>
<p><font face="monospace">For the second issue, if you are using
graalvm-jdk-24.0.1+9.1, try adding <br>
</font></p>
<div class="moz-cite-prefix"><font face="monospace">On 4/25/25 6:50
AM, ski n wrote:<br>
</font></div>
<blockquote type="cite" cite="mid:CABKVO1Wp8VMoWCZVRNaaw9iy1aEUwLHPubYKK4FjzM2bR6dAig@mail.gmail.com">
<div dir="ltr">
<div>
<div><font face="monospace">Thanks, the first issue is the
most present issue.<br>
<br>
</font></div>
<font face="monospace">The other one may have happened,
because I added an optional argument which wasn't in the
training run.<br>
<br>
</font></div>
<font face="monospace">Raymond</font></div>
<font face="monospace"><br>
</font>
<div class="gmail_quote gmail_quote_container">
<div dir="ltr" class="gmail_attr"><font face="monospace">On Fri,
Apr 25, 2025 at 2:40 PM Dan Heidinga <<a href="mailto:dan.heidinga@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">dan.heidinga@oracle.com</a>>
wrote:<br>
</font></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="msg-1232924631905389807">
<div lang="EN-CA" style="overflow-wrap: break-word;">
<div class="m_-1232924631905389807WordSection1">
<p class="MsoNormal"><font face="monospace"><span style="font-size:11pt">Thanks for reporting the
issue. I see Ioi has run into the same problem
with MethodHandleImpl::BindCaller and is putting
together a fix in
<a href="https://bugs.openjdk.org/browse/JDK-8354890" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8354890</a></span></font></p>
<p class="MsoNormal"><font face="monospace"><span style="font-size:11pt"> </span></font></p>
<p class="MsoNormal"><font face="monospace"><span style="font-size:11pt">For the second issue:</span></font></p>
<p class="MsoNormal" style="margin-left:36pt"><font face="monospace"><span style="font-size:12pt">I
still got this error and warning:<br>
<br>
[0.026s][error][cds] CDS archive has aot-linked
classes. It cannot be used when archived full
module graph is not used.<br>
[0.017s][warning][cds] shared class paths mismatch
(hint: enable -Xlog:class+path=info to diagnose
the failure)</span></font></p>
<p class="MsoNormal"><font face="monospace"><span style="font-size:11pt"> </span></font></p>
<p class="MsoNormal"><font face="monospace"><span style="font-size:11pt">Have you confirmed that the
class paths are the same between the assembly
phase (</span><span style="font-size:12pt">-XX:AOTMode=create)
</span><span style="font-size:11pt">and when using
the cache? Confirming the “</span><span style="font-size:12pt">-Xlog:class+path=info”
output from both the assembly and production runs
are the same would help.</span></font></p>
<p class="MsoNormal"><font face="monospace"><span style="font-size:12pt"> </span></font></p>
<p class="MsoNormal"><font face="monospace"><span style="font-size:12pt">--Dan</span><span style="font-size:11pt"></span></font></p>
<p class="MsoNormal"><font face="monospace"><span style="font-size:11pt"> </span></font></p>
<div id="m_-1232924631905389807mail-editor-reference-message-container">
<div>
<div>
<div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(181,196,223) currentcolor currentcolor;padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12pt;margin-left:36pt">
<font face="monospace"><b><span style="font-size:12pt;color:black">From:
</span></b><span style="font-size:12pt;color:black">leyden-dev
<<a href="mailto:leyden-dev-retn@openjdk.org" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">leyden-dev-retn@openjdk.org</a>>
on behalf of ski n <<a href="mailto:raymondmeester@gmail.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">raymondmeester@gmail.com</a>><br>
<b>Date: </b>Friday, April 25, 2025 at
4:59</span><span style="font-size: 12pt; color: black;"> </span><span style="font-size:12pt;color:black">AM<br>
<b>To: </b><a href="mailto:leyden-dev@openjdk.org" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">leyden-dev@openjdk.org</a>
<<a href="mailto:leyden-dev@openjdk.org" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">leyden-dev@openjdk.org</a>><br>
<b>Subject: </b>How to handle errors</span></font></p>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:36pt"><font face="monospace"><span style="font-size:12pt"> </span></font></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12pt;margin-left:36pt">
<font face="monospace"><span style="font-size:12pt">Hi
Leyden devs,</span></font></p>
</div>
<p class="MsoNormal" style="margin-left:36pt"><font face="monospace"><span style="font-size:12pt">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</span></font></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12pt;margin-left:36pt">
<font face="monospace"><span style="font-size:12pt">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.</span></font></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12pt;margin-left:36pt">
<font face="monospace"><span style="font-size:12pt">I run the
following commands:<br>
<br>
D:\test\graalvm-jdk-24.0.1+9.1\bin\java -XX:AOTMode=record
-XX:AOTConfiguration=app.aotconf
-jar gateway-5.1.0.jar<br>
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<br>
D:\test\graalvm-jdk-24.0.1+9.1\bin\java -XX:AOTCache=app.aot -jar
gateway-5.1.0.jar</span></font></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12pt;margin-left:36pt">
<font face="monospace"><span style="font-size:12pt">However, on
the second command, I get these
warnings/errors:<br>
<br>
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<br>
[0.657s][warning][cds] Skipping
jdk/internal/event/Event: JFR event
class<br>
[1.147s][warning][cds,heap] Archive
heap points to a static field that
may hold a different value at
runtime:<br>
[1.148s][warning][cds,heap] Field:
java/lang/invoke/MethodHandleImpl$BindCaller::CD_Object_array<br>
[1.150s][warning][cds,heap] Value:
jdk.internal.constant.ArrayClassDescImpl<br>
[1.150s][warning][cds,heap]
{0x0000000605959028} - klass:
'jdk/internal/constant/ArrayClassDescImpl'
- flags:<br>
[1.150s][warning][cds,heap]<br>
[1.151s][warning][cds,heap] - ----
fields (total size 3 words):<br>
[1.151s][warning][cds,heap] -
private final 'rank' 'I' @12 1
(0x00000001)<br>
[1.152s][warning][cds,heap] -
private final 'elementType'
'Ljava/lang/constant/ClassDesc;' @16
a
'jdk/internal/constant/ClassOrInterfaceDescImpl'{0x0000000605914380}
(0xc0b22870)<br>
[1.152s][warning][cds,heap] -
private 'cachedDescriptorString'
'Ljava/lang/String;' @20
"[Ljava/lang/Object;"{0x0000000605959040}
(0xc0b2b208)<br>
[1.152s][warning][cds,heap] ---
trace begin ---<br>
[1.153s][warning][cds,heap] [ 0]
{0x0000000605b73798} java.lang.Class
(jdk.internal.constant.ConstantUtils::CD_Object_array)<br>
[1.153s][warning][cds,heap] [ 1]
{0x0000000605959028}
jdk.internal.constant.ArrayClassDescImpl<br>
[1.153s][warning][cds,heap] ---
trace end ---<br>
[1.153s][warning][cds,heap]<br>
[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.<br>
[1.154s][error ][cds ] An error
has occurred while writing the
shared archive file.</span></font></p>
</div>
<p class="MsoNormal" style="margin-left:36pt"><font face="monospace"><span style="font-size:12pt">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.</span></font></p>
</div>
<p class="MsoNormal" style="margin-left:36pt"><font face="monospace"><span style="font-size:12pt"> </span></font></p>
</div>
<p class="MsoNormal" style="margin-left:36pt"><font face="monospace"><span style="font-size:12pt">I still got this
error and warning:<br>
<br>
[0.026s][error][cds] CDS archive has
aot-linked classes. It cannot be used when
archived full module graph is not used.<br>
[0.017s][warning][cds] shared class paths
mismatch (hint: enable
-Xlog:class+path=info to diagnose the
failure)</span></font></p>
<div>
<p class="MsoNormal" style="margin-left:36pt"><font face="monospace"><span style="font-size:12pt"> </span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12pt;margin-left:36pt">
<font face="monospace"><span style="font-size:12pt">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:<br>
<br>
<a href="https://github.com/assimbly/gateway/releases/tag/5.1.0Beta" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/assimbly/gateway/releases/tag/5.1.0Beta</a></span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12pt;margin-left:36pt">
<font face="monospace"><span style="font-size:12pt">I am creating the
AOTCache properly? And how to mitigate
such warnings/errors?</span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"><font face="monospace"><span style="font-size:12pt">Raymond</span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12pt;margin-left:36pt">
<font face="monospace"><span style="font-size:12pt"> </span></font></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</body>
</html>