On Thu, 27 Nov 2025 20:53:32 GMT, Leonid Mesnik <[email protected]> wrote:

>> The AOT allocates objects while holding lock. The jvmti events can't be 
>> posted in such case. The allocation sampling might be just temporary 
>> disabled while AOT objects are allocated. 
>> 
>> I prefer to disable jvmti events for allocation only, not for AOT globally. 
>> If there are more events should be generated during AOT initialization, we 
>> might want to preserve them and post after initialization is completed. 
>> 
>> The existing failure could be reproduced by running tests with jvmti stress 
>> agent and ZGC enabled. Like
>> make run-test JTREG_JVMTI_STRESS_AGENT=debugger=true 
>> TEST=gc/z/TestGarbageCollectorMXBean.java
>> 
>> Note: 
>> I prelaced NoJvmtiVMObjectAllocMark, it was not used. Also it was incorrect. 
>> The 
>> NoJvmtiEventsMark should be set even if jvmti events are not enable for this 
>> thread. Since jvmti events might be enabled just in the middle of the mark.
>
> Leonid Mesnik has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Added regression test

This is good, but we also use the _is_disable_suspend flag to disable JVMTI 
events for similar reasons, but only from the AOT thread. Now that we have a 
better more explicit boolean for disabling JVMTI events, perhaps we should stop 
toggling the _is_disable_suspend flag on the AOT thread, in favour of using 
this new more explicit mechanism.

Having said that, if we do, then the disabling mechanism needs to be able to 
cope with nesting. If you agree, then I don't mind if we want to do that 
refactoring separately from this fix though. The fix looks good otherwise.

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

Changes requested by eosterlund (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28544#pullrequestreview-3518962513

Reply via email to