> Please review this fix that avoids `JvmtiAgent::convert_xrun_agent` from 
> prematurely exiting VM if `lookup_On_Load_entry_point` cannot load the agent 
> using `JVM_OnLoad` symbol. Thanks
> 
> `lookup_On_Load_entry_point` first tries to load the builtin agent from the 
> executable by checking the requested symbol (`JVM_OnLoad`). If no builtin 
> agent is found, it then tries to load the agent shared library (e.g. 
> `libjdwp.so`) by calling `load_library`. The issue is that `load_library` is 
> called with `vm_exit_on_error` set to `true`, which causes the VM to exit 
> immediately if the agent shared library is not loaded. Therefore, 
> `JvmtiAgent::convert_xrun_agent` has no chance to try loading the agent using 
> `Agent_OnLoad` symbol 
> (https://github.com/openjdk/jdk/blob/19154f7af34bf6f13d61d7a9f05d6277964845d8/src/hotspot/share/prims/jvmtiAgent.cpp#L352).
>  This is a hidden issue on regular JDK, since the `load_library` can 
> successfully find the agent shared library when 
> `JvmtiAgent::convert_xrun_agent` first tries to load the agent using 
> `JVM_OnLoad` symbol. The issue is noticed on static JDK as there is no 
> `libjdwp.so` in static JDK. It can be reproduced with jtreg 
> `runtime/6294277/Sou
 rceDebugExtension.java` test.
> 
> As part of the fix, I cleaned up following in `invoke_JVM_OnLoad` and 
> `invoke_Agent_OnLoad`. If there's an error, the VM should already have exited 
> during `lookup_<JVM|Agent>_OnLoad_entry_point` in those cases.
> 
> 
>   if (on_load_entry == nullptr) {
>     vm_exit_during_initialization("Could not find ... function in -Xrun 
> library", agent->name());
>   }

Jiangli Zhou has updated the pull request incrementally with two additional 
commits since the last revision:

 - Apply @dholmes-ora's edit suggestion.
   
   Co-authored-by: David Holmes <62092539+dholmes-...@users.noreply.github.com>
 - Apply @dholmes-ora's suggestion to use single line.
   
   Co-authored-by: David Holmes <62092539+dholmes-...@users.noreply.github.com>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24086/files
  - new: https://git.openjdk.org/jdk/pull/24086/files/b165b86f..745d4c0e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24086&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24086&range=00-01

  Stats: 4 lines in 1 file changed: 0 ins; 2 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/24086.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24086/head:pull/24086

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

Reply via email to