RFR: 8293806: JDK_JAVA_OPTIONS picked up twice if launcher re-executes itself

Dmitry Samersoff dsamersoff at openjdk.org
Tue Dec 13 08:25:51 UTC 2022


On Thu, 8 Dec 2022 14:21:36 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> If the user has set LD_LIBRARY_PATH to use a particular libjvm.so, options from the JDK_JAVA_OPTIONS environment variable are picked up twice.
>> 
>> If an option cannot be accepted twice (e.g., -agentlib), the application fails to start.
>> 
>> The same happens on operating systems that doesn't support $RPATH/$ORIGIN and always have to set LD_LIBRARY_PATH and re-exec the launcher.
>> 
>> This fix takes the approach to re-launch as early as possible, as discussed here:
>> 
>> https://github.com/openjdk/jdk/pull/10430
>> 
>> This PR consists of three commits:
>> 1. Cleanup of java_md.c
>> 2. The implementation of early re-launch
>> 3. Performance optimization
>> 
>> @AlanBateman, @dholmes-ora Alan, David - any comments are appreciated.
>
> src/java.base/share/native/libjli/java.c line 368:
> 
>> 366: #endif
>> 367: 
>> 368:     JLI_SetTraceLauncher();
> 
> It's confusing to call JLI_SetTraceLauncher here as that is normally done by InitiLauncher.

Agree. Will file a separate CR for java_md.c cleanup.

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

PR: https://git.openjdk.org/jdk/pull/11538


More information about the hotspot-runtime-dev mailing list