RFR: 8350982: -server|-client causes fatal exception on static JDK
Alan Bateman
alanb at openjdk.org
Tue Mar 4 12:13:54 UTC 2025
On Tue, 4 Mar 2025 06:55:33 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Please review the `Arguments::parse_each_vm_init_arg` change to ignore`-server|-client` options, which avoids unrecognized option error on static JDK.
>>
>> On regular JDK, '-server|-client' options are processed/removed from command-line arguments by `CheckJvmType` during `CreateExecutionEnvironment`. That happens before `Arguments::parse_each_vm_init_arg` is called. With jvm.cfg setting, only server vm is known and client is ignored. So specifying '-server' and '-client' in command-line is really a no-op.
>>
>> On static JDK, the VM is statically linked with the launcher, and `CreateExecutionEnvironment` & `CheckJvmType` are not called. As the result, `Arguments::parse_each_vm_init_arg` could see `-server|-client` when running on static JDK, if the options are specified in the command line.
>
> src/hotspot/share/runtime/arguments.cpp line 2812:
>
>> 2810: // On regular JDK, '-server|-client' options are processed and removed
>> 2811: // from command-line arguments by CheckJvmType (see
>> 2812: // src/java.base/share/native/libjli/java.c). When running on static JDK,
>
> Why not remove this in the launcher?
In addition to David's comment, I think we have to wonder why anyone would specify -client or -server when using a statically linked image. There's isn't a choice when using a statically linked image.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23881#discussion_r1979303185
More information about the hotspot-runtime-dev
mailing list