Before posting the VM_DEATH event the JVMTI code spins for up to 60 seconds to 
allow in-progress callbacks to complete. If one of those callbacks requires a 
safepoint while executing, then it will not be able to  attain it until the 60s 
spin is over - thus causing an apparent "hang" at VM termination. The simple 
fix is to insert a `ThreadBlockInVM` in the loop so that safepoint requests are 
honored.

Testing:
- tiers 1-5
- new regression test

Thanks.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - 8387045: JDK with transformer agent hangs on shutdown

Changes: https://git.openjdk.org/jdk/pull/31982/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31982&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8387045
  Stats: 165 lines in 2 files changed: 165 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/31982.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/31982/head:pull/31982

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

Reply via email to