RFR: 8293806: JDK_JAVA_OPTIONS picked up twice if LD_LIBRARY_PATH is set
David Holmes
dholmes at openjdk.org
Thu Sep 29 04:53:24 UTC 2022
On Mon, 26 Sep 2022 18:15:17 GMT, Dmitry Samersoff <dsamersoff 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.
>
> The fix adds one additional argument - orig_argv to JLI_Launch() and use it in on relaunch in execv() call.
>
> All relevant jtreg tests are passed.
Sorry Dmitry I'm still trying to get my head around the big picture here. The launcher startup process is extremely complex but also quite sophisticated so I'm a bit surprised this issue exists (and that we have not noticed it before!). I have an impression that the intent if we re-exec is that the env var options have already been processed and so the newly exec'd `java` is not supposed to process them again (they have already been converted to items in `argv`) - see `JLI_AddArgsFromEnvVar` and the use of the `relaunch` field. It seems quite redundant to have the exec'd `java` repeat all the arg processing that has already taken place.
I'm also struggling to understand under what conditions, exactly, we will re-exec when the data-model selection is no longer an issue.
-------------
PR: https://git.openjdk.org/jdk/pull/10430
More information about the core-libs-dev
mailing list