On Thu, 27 Nov 2025 20:12:11 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.

This pull request has now been integrated.

Changeset: f5e4cd7f
Author:    Leonid Mesnik <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/f5e4cd7f0d12fd21399b192b32a5c9abfe8a3564
Stats:     194 lines in 8 files changed: 150 ins; 30 del; 14 mod

8372039: post_sampled_object_alloc is called while lock is handled

Reviewed-by: sspitsyn, eosterlund, amenkov

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

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

Reply via email to