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

Unsupported GC options passed in JAVA_TOOL_OPTIONS are silently ignored

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11, 15, 16
    • Fix Version/s: 16
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc
    • Resolved In Build:
      b17

      Description

      We have actually observed it with JDK 11u jobs trying to run ZGC on Windows. But the issue is not ZGC-specific, and it affects head jdk as well.

      Steps to reproduce:

      1. Build current jdk with --with-jvm-features=-zgc

      2. Do: export JAVA_TOOL_OPTIONS="-XX:+UseZGC"

      3. Run -version, observing silent fallback to G1:

      $ jdk/build/linux-x86_64-server-fastdebug/images/jdk/bin/java -Xlog:gc -version
      Picked up JAVA_TOOL_OPTIONS: -XX:+UseZGC
      [0.036s][info][gc] Using G1

      4. Run with explicit flags:

      ~/trunks/jdk/build/linux-x86_64-server-fastdebug/images/jdk/bin/java -Xlog:gc -XX:+UseZGC -version
      Picked up JAVA_TOOL_OPTIONS: -XX:+UseZGC
      Error occurred during initialization of VM
      Option -XX:+UseZGC not supported

      I think that happens because GCConfig checks only for FLAG_IS_CMDLINE, which is only from cmdline-originated flags. In this case, the flag comes from the environment variable. Maybe checking for !FLAG_IS_DEFAULT is better, as it captures all non-default origins.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shade Aleksey Shipilev
              Reporter:
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: