RFR: 8281472: JVM options processing silently truncates large illegal options values

David Holmes dholmes at openjdk.java.net
Fri Feb 18 13:50:51 UTC 2022


On Fri, 18 Feb 2022 13:27:40 GMT, Harold Seigel <hseigel at openjdk.org> wrote:

>> src/hotspot/share/runtime/arguments.cpp line 874:
>> 
>>> 872:     if (v > (julong)max_juint + 1) {
>>> 873:       return false;
>>> 874:     }
>> 
>> This seems very suspicious. Where is the code that depends on this?
>
> Test test/hotspot/jtreg/gc/arguments/TestParallelGCThreads.java has the following code:
> 
> 
>     // 4294967295 == (unsigned int) -1
>     // So setting ParallelGCThreads=4294967295 should give back 4294967295
>     // and setting ParallelGCThreads=4294967296 should give back 0. (SerialGC is ok with ParallelGCThreads=0)
>     for (long i = 4294967295L; i <= 4294967296L; i++) {
>       long count = getParallelGCThreadCount(
>           "-XX:+UseSerialGC",
>           "-XX:ParallelGCThreads=" + i,
>           "-XX:+PrintFlagsFinal",
>           "-version");
>       Asserts.assertEQ(count, i % 4294967296L, "Specifying ParallelGCThreads=" + i + " does not set the thread count properly!");
>     }
>   }

That test seems bizarre to me - perhaps someone from GC team can comment on why it expects to see what it sees. But I would not suggest we cripple the argument processing logic just because one test expects it to behave in a strange way.

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

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


More information about the hotspot-dev mailing list