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

JVM crashes on Windows 10 using --module=NAME

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 11.0.2, 11.0.5-oracle, 12.0.2, 13.0.1, 14
    • Fix Version/s: 14
    • Component/s: tools
    • Environment:
    • Subcomponent:
    • Resolved In Build:
      b27
    • CPU:
      x86_64
    • OS:
      windows_10

      Backports

        Description

        Relying on the "Note: To specify an argument for a long option, you can use either --name=value or --name value." from [0] and assuming that `--module` is a long option (with `-m` being its short counterpart) I think I found an error in `java.exe`.

        A minimal, complete and verifiable example at [2] -- which contains a README.md file with more details. Here's a gist:

        Calling `java --module-path=lib --module=m/Main --help ...` sometimes fails to launch the JVM. The failure, if it occurs, expresses mostly via a silent exit of the `java.exe` program leaving a negative value in the "DOS shell" `ERRORLEVEL` environment variable. Seldom, a fatal error log is written to the current working directory.

        The underlying reason seems to be an error in the calculation of the application argument count and index. The later reads: {{ AppArgIndex: -1 points to (null) }}

        Work-around: omit the `=` (equals sign) after `--module` and the entry-point, here `m/Main`. This command line always gets the JVM up and running.

        [0] https://docs.oracle.com/en/java/javase/11/tools/java.html
        [1] https://bugs.openjdk.java.net/browse/JDK-8234076
        [2] https://github.com/sormuras/JDK-8234076



        # Original Bug Description

        Running the following command in a Windows (`cmd`) Console
        ```
        java
          --module-path=
            bin/build/test/modules/it.jar;
            bin/build/main/modules;
            bin/build/test/modules;
            lib
        --add-modules=it
        --module=org.junit.platform.console
        --select-module=it
        ```
        the JVM sometimes(!) crashes.

        ## Reproduction

        - Clone https://github.com/sormuras/bach-air - and switch to branch `JDK-8234076`
        - Invoke `java src\build\Build.java`

        Here's a GitHub Actions run showing the fatal errors on JDK 11 and 13: https://github.com/sormuras/bach-air/runs/300828140

        Locally, I could reproduce similar errors using OpenJDK 11.0.2, 13.0.1 and also 14-ea+22 versions. Same, same for AdoptJDK 11.0.5 as can be seen here: https://github.com/AdoptOpenJDK/openjdk-build/issues/1378 -- this issue also contains some `hs_err_pid...log` files.


        ## Work-around

        Use `--module org.junit.platform.console` -- without the `=` character.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  henryjen Henry Jen
                  Reporter:
                  cstein Christian Stein
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: