RFR: 8253412: Unsupported GC options passed in JAVA_TOOL_OPTIONS are silently ignored

Per Lidén pliden at openjdk.java.net
Tue Sep 22 07:58:06 UTC 2020


On Mon, 21 Sep 2020 10:07:22 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> See the reproducer in the bug itself. 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.   But them, instead of checking for
> `FLAG_IS_CMDLINE`, I think we can rely on the fact that all `Use*GC` options are `false` by default. So if any of such
> flags is `true`, it means something had selected the GC. This allows for some further simplification of the macro
> (although I am not sure if it was intended to be ever used to check `-XX:-*` flags).  Attention @pliden.
> Testing:
>  - [x] Ad-hoc reproducer now passes
>  - [x] Linux x86_64 fastdebug tier1
>  - [x] Linux x86_64 fastdebug tier2

FLAG_IS_CMDLINE is often used as "FLAG_IS_USERSPECIFIED". So I have the feeling many (most?) uses of FLAG_IS_CMDLINE is
semi-broken, given that options coming in through JAVA_TOOLS_OPTIONS and _JAVA_OPTIONS isn't considered part of the
command-line.

Anyway, this change looks good to me.

-------------

Marked as reviewed by pliden (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/282



More information about the hotspot-gc-dev mailing list