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

Dmitry Samersoff dsamersoff at openjdk.org
Tue Oct 18 15:01:58 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.

It's exactly what I'm trying to do - fix the broken logic around relaunch variable. 

We have couple of options here:

1. Decide re-launch/not-relaunch before processing arguments.
      - it's (IMHO) the best solution, but it requires significant refactor of the launcher.
      
2. Pass initial argv to the secondary launcher, which is re-launched and repeat argument processing. 
    -  it's what was implemented in this patch.
    
4. Let the secondary launcher know that the arguments was already processed.
    - to do this we need to use some kind of IPC: another environment variable; additional command-line option, which we will then remove etc.    
      @dholmes-ora if you think that this is the way, please advice - which method of such communication you prefer.

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

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


More information about the core-libs-dev mailing list