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

CDS archive creation aborts due to metaspace object allocation failure

    Details

    • Subcomponent:
    • Resolved In Build:
      b20

      Backports

        Description

        [This bug was discovered during investigation of JDK-8211956]

        When creating a CDS archive for jruby 9.2.0.0, the following error happens once every few times. When the failure happens, The reported request size that triggered the failure may be different.

        Loading classes to share: done.
        Rewriting and linking classes ...
        Rewriting and linking classes: done
        Number of classes 7323
            instance classes = 7244
            obj array classes = 71
            type array classes = 8
        Updating ConstMethods ... done.
        Removing unshareable information ... done.
        Failed allocating metaspace object type TypeArrayU8 of size 24. CDS dump aborted.
        Please increase MaxMetaspaceSize (currently 18446744073709547520 bytes).

        ============
        Steps to reproduce:
        1. Download https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.2.0.0/jruby-dist-9.2.0.0-bin.tar.gz (or from attachment in this bug report)
        2. Download jruby-startup.tar.gz from attachment in this bug report
        3. Download JDK 11 -- OpenJDK Runtime Environment 18.9 (build 11+28)
        4. Extract the above files to

        $HOME/jruby/jruby-9.2.0.0/bin
        $HOME/jruby/jruby-startup
        $HOME/jruby/jdk-11

        5. Run the following scripts to set up your environment

        unalias java
        unalias jruby
        unset JAVA_HOME
        export PATH=$HOME/jruby/jruby-9.2.0.0/bin:$PATH
        export PATH=$HOME/jruby/jdk-11/bin:$PATH
        java -version
        jruby -J-version
        type jruby

        It should report the following versions:
        $ java -version
        openjdk version "11" 2018-09-25
        OpenJDK Runtime Environment 18.9 (build 11+28)
        OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
        $ jruby -J-version
        openjdk version "11" 2018-09-25
        OpenJDK Runtime Environment 18.9 (build 11+28)
        OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
        $ type jruby
        jruby is hashed (/home/iklam/jruby/jruby-9.2.0.0/bin/jruby)

        6. Run the following command to reproduce the failure. You may need to run it several times for it to fail:

        cd ~/jruby/jruby-startup
        JAVA_OPTS="-Xmx256m" jruby -Ilib bin/generate-appcds "-S gem list"

        7. Once the failure has happened, you can run the following command to reproduce it more quickly (without doing a trial run)

        VERIFY_JRUBY=1 JAVA_OPTS="-Xshare:dump -XX:+UnlockDiagnosticVMOptions -XX:SharedClassListFile=$HOME/jruby/jruby-9.2.0.0/lib/jruby.list -XX:SharedArchiveFile=$HOME/jruby/jruby-9.2.0.0/lib/jruby.jsa" $HOME/jruby/jruby-9.2.0.0/bin/jruby -S gem list

        the above command actually exec's the following, which can be used to debug the problem in gdb

        java -Xshare:dump -XX:+UnlockDiagnosticVMOptions \
            -XX:SharedClassListFile=${HOME}/jruby/jruby-9.2.0.0/lib/jruby.list \
            -XX:SharedArchiveFile=${HOME}/jruby/jruby-9.2.0.0/lib/jruby.jsa \
            -Xss2048k \
            -Djffi.boot.library.path=${HOME}/jruby/jruby-9.2.0.0/lib/jni \
            -Djava.security.egd=file:/dev/urandom \
            -classpath \
            ${HOME}/jruby/jruby-9.2.0.0/lib/jruby.jar:: \
            -Djruby.home=${HOME}/jruby/jruby-9.2.0.0 \
            -Djruby.lib=${HOME}/jruby/jruby-9.2.0.0/lib \
            -Djruby.script=jruby \
            -Djruby.shell=/bin/sh



          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  iklam Ioi Lam
                  Reporter:
                  iklam Ioi Lam
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: