On Thu, 12 Nov 2020 01:34:33 GMT, Yasumasa Suenaga <[email protected]> wrote:

>> If we can change the spec that agent library would not be unloaded when 
>> `Agent_OnAttach()` failed, we can change like 
>> [webrev.00](https://cr.openjdk.java.net/~ysuenaga/JDK-8252657/webrev.00/). 
>> It is simple, and similar behavior with `Agent_OnLoad()`. It might be prefer 
>> for JVMTI agent developers.
>
> In case of `Agent_OnLoad()`, if it is failed (it returns other than zero), 
> JVM is aborted and `Agent_OnUnload()` is not called. I think it is compliant 
> with [JVMTI spec of 
> Agent_OnUnload()](https://docs.oracle.com/en/java/javase/15/docs/specs/jvmti.html#onunload)
>  which says uncontrolled shutdown (aborting JVM) is an exception to this rule.
> 
> I will add CSR for this fix, but I want to discuss what we should do before. 
> I like that `Agent_OnUnload()` wouldn't be called when `Agent_OnAttach()` is 
> failed if we can change the spec - it is consistent and friendly with 
> `Agent_OnLoad()`.

I added [CSR for this PR](https://wiki.openjdk.java.net/display/csr/Main) and 
updated patch. Could you review it?
I think it is reasonable to clarify the spec not to call `Agent_OnUnload()` 
when `Agent_OnLoad()` or `Agent_OnAttach()` are failed. It is nature for me, 
and it does not change current behavior in HotSpot.

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

PR: https://git.openjdk.java.net/jdk/pull/19

Reply via email to