On Mon, 30 Nov 2026 19:08:25 GMT, Leonid Mesnik <[email protected]> wrote:

> During exit VM disable execution of new JVMTI events and waits for already 
> started events before  changing jvmti phase to dead.  
> 
> Thus it exits from VM event then it block itself. The fix updates vm_death to 
> wait only events on the other threads. 
> 
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

It looks good in general. I've posted a couple of nits.
This comment in the `jvmtiExport.cpp` needs an update:

void JvmtiExport::post_vm_death() {
  EVT_TRIG_TRACE(JVMTI_EVENT_VM_DEATH, ("Trg VM death event triggered" ));

  JvmtiTagMap::flush_all_object_free_events();

  // It is needed to disable event generation before setting DEAD phase and wait
  // until already executing events are finished.
  // The VM_DEATH should be the last posted event.

src/hotspot/share/prims/jvmtiEventController.inline.hpp line 122:

> 120: inline void JvmtiEventController::dec_in_callback_count() {
> 121:   AtomicAccess::dec(&_in_callback_count);
> 122:   --_current_thread_in_callback_count;

Nit: An assert checking for `_current_thread_in_callback_count > 0` would be 
useful here.

test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TransformerExitInPremainTest.java
 line 56:

> 54:         ProcessBuilder pb =
> 55:             
> ProcessTools.createLimitedTestJavaProcessBuilder("-javaagent:" + agentJar,
> 56:                                                              
> "-Xlog:class+load=info",

Nit: Is this logging option really needed? Its output is never checked. Is it 
for manual checks?

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

PR Review: https://git.openjdk.org/jdk/pull/34135#pullrequestreview-6124312047
PR Review Comment: https://git.openjdk.org/jdk/pull/34135#discussion_r4748594579
PR Review Comment: https://git.openjdk.org/jdk/pull/34135#discussion_r4748669201

Reply via email to