Hi Alan,

On 4/01/2017 10:15 PM, Alan Bateman wrote:
On 04/01/2017 10:39, David Holmes wrote:


That is my thought too, that the spec needs to give less of the
impression that it's okay to access java.base classes at this early VM
start event, and basically say that any form of class-loading is not
guaranteed to succeed and will quite likely crash the JVM.
The JVM TI spec has always allowed agents to call any JNI function in
the start phase. I don't think there was any intention to have agents
load and execute arbitrary java code but this wasn't fully spelled out.

Yes the spec has always been completely broken in this regard IMHO.

For JDK 9 then we attempt to preserve this compatibility for existing
agents by deferring the start phase until after the module system is
initialized (initPhase2). This has the side effect that they miss out on
some interesting events during startup. They can of course replay at
least some of them with GenerateEvents but it's not enough for some
agents. So this is the reason for the can_generate_early_vmstart
capability and it's intended for agents that take an oath of carefulness.

Understood.

So for the spec update then I think the restrictions can be mostly
limited to when the can_generate_early_vmstart capability is enabled.
Ideally we should avoid introducing yet another event that signals the
point in the start phase when it's safe to do things, agents can use the
VMInit for that.

My precise intent is to modify the text that was added in regard to the can_generate_early_vmstart capability, and further reduce expectations about what can be expected to work at that time. I have filed a new bug to make this correction to the JVM TI spec:

https://bugs.openjdk.java.net/browse/JDK-8172261

Thanks,
David

-Alan

Reply via email to