On Tue, 2 Dec 2025 21:09: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. > > Leonid Mesnik has updated the pull request incrementally with seven > additional commits since the last revision: > > - Apply suggestion from @alexmenkov > > Co-authored-by: Alex Menkov <[email protected]> > - Apply suggestion from @alexmenkov > > Co-authored-by: Alex Menkov <[email protected]> > - Apply suggestion from @alexmenkov > > Co-authored-by: Alex Menkov <[email protected]> > - Update > test/hotspot/jtreg/serviceability/jvmti/events/SampledObjectAlloc/SamplingDuringInit/libSamplingDuringInit.cpp > > Co-authored-by: Alex Menkov <[email protected]> > - Update > test/hotspot/jtreg/serviceability/jvmti/events/SampledObjectAlloc/SamplingDuringInit/SamplingDuringInit.java > > Co-authored-by: Alex Menkov <[email protected]> > - Update src/hotspot/share/runtime/javaThread.hpp > > Co-authored-by: Alex Menkov <[email protected]> > - Update src/hotspot/share/runtime/javaThread.cpp > > Co-authored-by: Alex Menkov <[email protected]> The fix looks good in general. I've requested a minor test update though. test/hotspot/jtreg/serviceability/jvmti/events/SampledObjectAlloc/SamplingDuringInit/libSamplingDuringInit.cpp line 32: > 30: SampledObjectAlloc(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jobject > object, jclass object_klass, jlong size) { > 31: LOG("Sampled object\n"); > 32: } I'd suggest to increment a counter here. Then check it at the end and fail if it is not 0. ------------- PR Review: https://git.openjdk.org/jdk/pull/28544#pullrequestreview-3532263502 PR Review Comment: https://git.openjdk.org/jdk/pull/28544#discussion_r2582904026
