Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8322657

CDS filemap fastdebug assert while loading Graal CE Polyglot in isolated classloader

    XMLWordPrintable

Details

    • b05

    Backports

      Description

        Steven Schlansker <stevenschlansker@gmail.com> reports:

        While debugging a still-unexplained 'IncompatibleClassChangeError:
        disagree on InnerClasses attribute', I tried to run our application in
        a fastdebug jvm with additional logging. Instead of reproducing the
        original issue, I hit an assertion error in CDS.

        # assert(ent->in_named_module()) failed: must be
        # Internal Error (/build/src/hotspot/share/cds/filemap.cpp:590),
        pid=633408, tid=633409

        V [libjvm.so+0x1414d60] ModuleEntry::ModuleEntry(Handle, bool,
        Symbol*, Symbol*, Symbol*, ClassLoaderData*)+0x300
        (moduleEntry.cpp:63)
        V [libjvm.so+0x1414fc1] ModuleEntryTable::locked_create_entry(Handle,
        bool, Symbol*, Symbol*, Symbol*, ClassLoaderData*)+0x1c1
        (moduleEntry.cpp:619)
        V [libjvm.so+0x141c23d] Modules::define_module(Handle, unsigned char,
        _jstring*, _jstring*, _jobjectArray*, JavaThread*)+0x1f1d
        (modules.cpp:402)
        V [libjvm.so+0x101b099] JVM_DefineModule+0xb9 (jvm.cpp:1112)
        V [libjvm.so+0xc130e7]
        FileMapInfo::get_module_shared_path_index(Symbol*)+0x377
        (filemap.cpp:590)

        Fedora 39 Linux 6.6.6 x86_64
        Reproduced on java 21u26 and 23 (519ecd352a66633589f160db7390647d90e36b99)

        hs_err: https://gist.github.com/stevenschlansker/14b748af7758e4ea846ac22f12e53453

        To reproduce, this is the source:

        import java.io.File;
        import java.io.UncheckedIOException;
        import java.net.MalformedURLException;
        import java.net.URL;
        import java.net.URLClassLoader;
        import java.util.stream.Stream;

        public class PolyglotBoom {
            public static void main(final String... args) throws Exception {
                final var cl = new URLClassLoader(
                        Stream.of(
                                "polyglot",
                                "nativeimage",
                                "truffle-api",
                                "js-language",
                                "word",
                                "collections",
                                "icu4j",
                                "regex")
                                    .map(fn -> {
                                        try {
                                            return new File("tmp/" + fn +
        "-23.1.1.jar").toURL();
                                        } catch (final MalformedURLException e) {
                                            throw new UncheckedIOException(e);
                                        }
                                    })
                                    .toArray(URL[]::new));
                final var engine =
        Class.forName("org.graalvm.polyglot.Engine", false, cl)
                        .getMethod("create")
                        .invoke(null);
                System.err.println("engine = " + engine);
            }
        }

        You must use a **fastdebug** build to 'make images' target to trigger
        the assertion

        You need the Graal CE 23.1.1 distribution placed in 'tmp/', I got it from
        https://repo1.maven.org/maven2/org/graalvm/ :

        polyglot-23.1.1.jar
        nativeimage-23.1.1.jar
        truffle-api-23.1.1.jar
        js-language-23.1.1.jar
        word-23.1.1.jar
        collections-23.1.1.jar
        icu4j-23.1.1.jar
        regex-23.1.1.jar

        Also, at least glassfish jaxb-runtime is needed also in 'tmp/' :
        https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-runtime/2.3.1/jaxb-runtime-2.3.1.jar

        Run attached program:
        % javac PolyglotBoom.java
        % jar cf tmp.jar PolyglotBoom.class
        % ~/code/jdk/build/linux-x86_64-server-fastdebug/images/jdk/bin/java
        -cp tmp.jar:tmp/\* -XX:ArchiveClassesAtExit=archive.jsa PolyglotBoom

        Please let me know if I can provide any additional information. And it
        would be good to get the bug reporting tool fixed 🙂
        Thank you!

        Attachments

          Issue Links

            Activity

              People

                ccheung Calvin Cheung
                dholmes David Holmes
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: