<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Hi Olivier,</p>
    <p>Thank you for the bug report and information about
      reproduction/work-around. I have created two tracking bugs:</p>
    <p><a class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8355555">https://bugs.openjdk.org/browse/JDK-8355555</a><br>
      [leyden] -XX:+ArchiveLoaderLookupCache fails with large
      ConcurrentHashMap backing array<br>
      <br>
      <a class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8355556">https://bugs.openjdk.org/browse/JDK-8355556</a><br>
      Bouncy Castle signed jar causes crash with AOT cache<br>
    </p>
    <p><br>
    </p>
    <p>Also, thank you for sharing the performance numbers. They are
      very encouraging!</p>
    <p>If you encounter other issues or have other requests, please feel
      free to post to this mailing list. We will love to hear from our
      users.</p>
    <p>Thanks</p>
    <p>- Ioi <br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 4/22/25 2:49 AM, Olivier Bourgain
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAP+OV9rJSeqKkQ6vjY-0OP41V=LNiSHm49RC6P7ThhLSMoiUuA@mail.gmail.com">
      
      <div dir="ltr">
        <div dir="ltr">
          <div>Hello,</div>
          <div><br>
          </div>
          <div>I tested the premain branch on <font size="2"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;font-family:arial,sans-serif">a pretty large Spring Boot application (>1M loc, fat jar is about 240MB) and had two issues.</span></font></div>
          <div><font size="2"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;font-family:arial,sans-serif">
</span></font></div>
          <div><font size="2"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;font-family:arial,sans-serif">First issue is similar to my previous issue </span></font><a href="https://mail.openjdk.org/pipermail/leyden-dev/2025-April/001875.html" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://mail.openjdk.org/pipermail/leyden-dev/2025-April/001875.html</a>,
            I had to set -XX:-ArchiveLoaderLookupCache to avoid Leyden
            failing due to a large ConcurrentHashMap's backing array.</div>
          <div><br>
          </div>
          <div>Second issue is way worse, I had a segfault on
            application start.</div>
          <div><font size="2">I tracked down the issue to:</font></div>
          <div><font size="2">- use the Bouncy Castle security provider</font></div>
          <div><font size="2">- </font><font size="2">run as a Spring
              Boot app.</font><br>
            <div><font size="2"><br>
              </font></div>
            <div><font size="2">I created a reproducer there </font><a href="https://github.com/obourgain/leyden-crash" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/obourgain/leyden-crash</a></div>
            <div>
              <div><font size="2">I couldn't reproduce as a simple main,
                  but it should be possible to reduce the size of the
                  reproducer even more.</font></div>
            </div>
            <div><br>
            </div>
            <div>Some observati<font size="2"><span style="font-family:arial,sans-serif">ons:</span></font></div>
            <div>
              <div style="background-color:rgb(255,255,255);color:rgb(8,8,8)">
                <pre><font style="font-family:arial,sans-serif" size="2"><span style="color:rgb(0,51,179)">- </span>During the aotconf creation, bouncy castle classes are excluded because they are from a signed jar like:</font><font size="2"><span style="color:rgb(0,51,179);font-family:arial,sans-serif">
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">Skipping org/bouncycastle/jcajce/provider/asymmetric/util/BaseKeyFactorySpi: Signed JAR</span><span style="color:rgb(0,51,179);font-family:arial,sans-serif">
</span><span style="color:rgb(0,51,179);font-family:arial,sans-serif">
</span><font style="font-family:arial,sans-serif"><span style="color:rgb(0,51,179)">- </span>D</font></font><font size="2"><font style="font-family:arial,sans-serif">uring the AOT cache creation t</font></font><font size="2"><font style="font-family:arial,sans-serif">here are a lot of warnings , it may be related to the crash:</font><span style="color:rgb(0,51,179);font-family:arial,sans-serif">
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap] Archive heap points to a static field that may hold a different value at runtime:
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap] Field: sun/security/x509/AlgorithmId::SHA3_512withRSA_oid
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap] Value: sun.security.util.ObjectIdentifier
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap] {0x00000006000453b8} - klass: 'sun/security/util/ObjectIdentifier' - flags:
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap]
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap]  - ---- fields (total size 4 words):
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap]  - private 'componentLen' 'I' @12  -1 (0xffffffff)
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap]  - private transient 'componentsCalculated' 'Z' @16  false (0x00)
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap]  - private 'encoding' '[B' @20  [B{0x00000006000453d8} (0xc0008a7b)
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap]  - private volatile transient 'stringForm' 'Ljava/lang/String;' @24  "2.16.840.1.101.3.4.3.16"{0x0000000600045378} (0xc0008a6f)
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap]  - private 'components' 'Ljava/lang/Object;' @28  null (0x00000000)
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap] --- trace begin ---
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap] [ 0] {0x0000000600043330} java.util.concurrent.ConcurrentHashMap::table (offset = 20)
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap] [ 1] {0x0000000600043370} [Ljava.util.concurrent.ConcurrentHashMap$Node; @[87]
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap] [ 2] {0x0000000600045358} java.util.concurrent.ConcurrentHashMap$Node::val (offset = 20)
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap] [ 3] {0x00000006000453b8} sun.security.util.ObjectIdentifier
</span><span style="color:rgb(6,125,23);font-family:arial,sans-serif">[1,064s][warning][cds,heap] --- trace end ---</span><span style="color:rgb(0,51,179);font-family:arial,sans-serif">
</span><span style="color:rgb(0,51,179);font-family:arial,sans-serif">
</span><span style="color:rgb(0,51,179);font-family:arial,sans-serif">- </span><span style="font-family:arial,sans-serif">Sample Backtrace from the segfault:<span style="color:rgb(0,51,179)">
</span><span style="color:rgb(6,125,23)">💣</span><span style="color:rgb(6,125,23)"> Program crashed: Bad pointer dereference at 0x0000000000000000
</span><span style="color:rgb(6,125,23)">
</span><span style="color:rgb(6,125,23)">Thread 2 crashed:
</span><span style="color:rgb(6,125,23)">
</span><span style="color:rgb(6,125,23)"> 0 0x0000000000000000
</span><span style="color:rgb(6,125,23)"> 1 0x00000001132b5230
</span><span style="color:rgb(6,125,23)"> 2 0x00000001132b0154
</span><span style="color:rgb(6,125,23)"> 3 JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*) + 988 in libjvm.dylib at make/hotspot/src/hotspot/share/runtime/javaCalls.cpp:415:7
</span><span style="color:rgb(6,125,23)"> 4 InstanceKlass::call_class_initializer(JavaThread*) + 764 in libjvm.dylib at make/hotspot/src/hotspot/share/oops/instanceKlass.cpp:1777:5
</span><span style="color:rgb(6,125,23)"> 5 InstanceKlass::initialize_impl(JavaThread*) + 2748 in libjvm.dylib at make/hotspot/src/hotspot/share/oops/instanceKlass.cpp:1331:7
</span><span style="color:rgb(6,125,23)"> 6 InstanceKlass::initialize_impl(JavaThread*) + 1540 in libjvm.dylib at make/hotspot/src/hotspot/share/oops/instanceKlass.cpp:1292:20
</span><span style="color:rgb(6,125,23)"> 7 HeapShared::resolve_or_init_classes_for_subgraph_of(Klass*, bool, JavaThread*) + 900 in libjvm.dylib at make/hotspot/src/hotspot/share/cds/heapShared.cpp:1491:9
</span><span style="color:rgb(6,125,23)"> 8 HeapShared::initialize_from_archived_subgraph(JavaThread*, Klass*) + 336 in libjvm.dylib at make/hotspot/src/hotspot/share/cds/heapShared.cpp:1415:5
</span><span style="color:rgb(6,125,23)"> 9 JVM_InitializeFromArchive + 560 in libjvm.dylib at make/hotspot/src/hotspot/share/prims/jvm.cpp:3369:3
</span><span style="color:rgb(6,125,23)">10 0x00000001132b8e80
</span><span style="color:rgb(6,125,23)">11 0x00000001132b4a90
</span><span style="color:rgb(6,125,23)">12 0x00000001132b0154
</span><span style="color:rgb(6,125,23)">13 JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*) + 988 in libjvm.dylib at make/hotspot/src/hotspot/share/runtime/javaCalls.cpp:415:7
</span><span style="color:rgb(6,125,23)">14 InstanceKlass::call_class_initializer(JavaThread*) + 764 in libjvm.dylib at make/hotspot/src/hotspot/share/oops/instanceKlass.cpp:1777:5
</span><span style="color:rgb(6,125,23)">15 InstanceKlass::initialize_impl(JavaThread*) + 2748 in libjvm.dylib at make/hotspot/src/hotspot/share/oops/instanceKlass.cpp:1331:7
</span><span style="color:rgb(6,125,23)">16 LinkResolver::resolve_static_call(CallInfo&, LinkInfo const&, bool, JavaThread*) + 152 in libjvm.dylib at make/hotspot/src/hotspot/share/interpreter/linkResolver.cpp:1116:21
</span><span style="color:rgb(6,125,23)">17 LinkResolver::resolve_invokestatic(CallInfo&, constantPoolHandle const&, int, JavaThread*) + 52 in libjvm.dylib at make/hotspot/src/hotspot/share/interpreter/linkResolver.cpp:1749:3
</span><span style="color:rgb(6,125,23)">18 LinkResolver::resolve_invoke(CallInfo&, Handle, constantPoolHandle const&, int, Bytecodes::Code, JavaThread*) + 116 in libjvm.dylib at make/hotspot/src/hotspot/share/interpreter/linkResolver.cpp:1708:39
</span><span style="color:rgb(6,125,23)">19 InterpreterRuntime::resolve_invoke(JavaThread*, Bytecodes::Code) + 748 in libjvm.dylib at make/hotspot/src/hotspot/share/interpreter/interpreterRuntime.cpp:988:5
</span><span style="color:rgb(6,125,23)">20 InterpreterRuntime::resolve_invokestatic(JavaThread*) + 420 in libjvm.dylib at make/hotspot/src/hotspot/share/interpreter/interpreterRuntime.cpp:952:3
</span><span style="color:rgb(6,125,23)">21 InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code) + 2644 in libjvm.dylib at make/hotspot/src/hotspot/share/interpreter/interpreterRuntime.cpp:1167:37
</span><span style="color:rgb(6,125,23)">22 0x00000001132c48c4
</span><span style="color:rgb(6,125,23)">23 0x00000001132b0154
</span><span style="color:rgb(6,125,23)">24 JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*) + 988 in libjvm.dylib at make/hotspot/src/hotspot/share/runtime/javaCalls.cpp:415:7
</span><span style="color:rgb(6,125,23)">25 InstanceKlass::call_class_initializer(JavaThread*) + 764 in libjvm.dylib at make/hotspot/src/hotspot/share/oops/instanceKlass.cpp:1777:5
</span><span style="color:rgb(6,125,23)">26 InstanceKlass::initialize_impl(JavaThread*) + 2748 in libjvm.dylib at make/hotspot/src/hotspot/share/oops/instanceKlass.cpp:1331:7
</span><span style="color:rgb(6,125,23)">27 InstanceKlass::initialize_impl(JavaThread*) + 1540 in libjvm.dylib at make/hotspot/src/hotspot/share/oops/instanceKlass.cpp:1292:20
</span><span style="color:rgb(6,125,23)">28 HeapShared::init_classes_for_special_subgraph(Handle, JavaThread*) + 356 in libjvm.dylib at make/hotspot/src/hotspot/share/cds/heapShared.cpp:1387:13
</span><span style="color:rgb(6,125,23)">29 Threads::create_vm(JavaVMInitArgs*, bool*) + 1504 in libjvm.dylib at make/hotspot/src/hotspot/share/runtime/threads.cpp:808:5
</span><span style="color:rgb(6,125,23)">30 JNI_CreateJavaVM_inner(JavaVM_**, void**, void*) + 80 in libjvm.dylib at make/hotspot/src/hotspot/share/prims/jni.cpp:3587:12
</span><span style="color:rgb(6,125,23)">31 JNI_CreateJavaVM + 116 in libjvm.dylib at make/hotspot/src/hotspot/share/prims/jni.cpp:3678:14
</span><span style="color:rgb(6,125,23)">32 InitializeJVM + 184 in libjli.dylib at make/src/java.base/share/native/libjli/java.c:1510:9
</span><span style="color:rgb(6,125,23)">33 JavaMain + 256 in libjli.dylib at make/src/java.base/share/native/libjli/java.c:494:10
</span><span style="color:rgb(6,125,23)">34 ThreadJavaMain + 12 in libjli.dylib at make/src/java.base/macosx/native/libjli/java_md_macosx.m:679:29
</span><span style="color:rgb(6,125,23)">35 0x0000000197d71c0c _pthread_start + 136 in libsystem_pthread.dylib
</span><span style="color:rgb(0,51,179)">
</span></span></font></pre>
              </div>
              With regards to performance, with disabling the loading of
              BouncyCastleProvider in the application, it starts way
              faster and with lower resources, impressive work.</div>
            <div><br>
            </div>
            <div>- baseline (extracted Spring Boot jar)<br>
                Time (mean Â± Ïƒ):     11.510 s Â±  0.432 s    [User:
              32.354 s, System: 1.751 s]<br>
            </div>
            <div><br>
            </div>
            <div>- Leyden main branch</div>
            <div>  Time (mean Â± Ïƒ):      6.031 s Â±  0.090 s    [User:
              12.591 s, System: 0.513 s]</div>
            <div>aotcache file = 250 MB</div>
            <div><br>
            </div>
            <div>- Leyden premain branch<br>
                Time (mean Â± Ïƒ):      4.801 s Â±  0.022 s    [User: 6.662
              s, System: 0.390 s]<br>
              <div>aotcache file = 300 MB</div>
            </div>
            <div><br>
            </div>
            <div>Regards.</div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>