RFR: 8252657: JVMTI agent is not unloaded when Agent_OnAttach is failed

Yasumasa Suenaga suenaga at oss.nttdata.com
Tue Dec 1 04:46:14 UTC 2020


Hi Chris, David,

Currently Agent_OnUnload() is not called when Agent_OnLoad() is failed - JVM will abort.
Should we re-think this behavior?

https://github.com/YaSuenag/jvmti-examples/tree/master/helloworld

```
$ java -agentpath:/path/to/libhelloworld.so=error --version
Hello World from Agent_OnLoad()
   options = error
Error occurred during initialization of VM
agent library failed to init: /path/to/libhelloworld.so
```


Thanks,

Yasumasa


On 2020/12/01 11:44, David Holmes wrote:
> On 1/12/2020 11:45 am, Chris Plummer wrote:
>> On Fri, 2 Oct 2020 07:27:43 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
>>
>>>> * Q3: What has to be done for statically linked agent?
>>>
>>> JVMTI spec says "unless it is statically linked into the executable", so I think we can ignore about Agent_OnUnload_L() in this PR.
>>
>> I don't think that makes sense. If you call it for dynamically linked then you need to call it for statically linked also.
> 
> Agreed. Even though you can't physically unload the statically linked library, if it is logically unloaded by some mechanism, then Agent_OnUnload_L is supposed to be called.
> 
> David
> -----
> 
>> -------------
>>
>> PR: https://git.openjdk.java.net/jdk/pull/19
>>


More information about the serviceability-dev mailing list