RFR: 8373944: ObjectMonitor::ExitOnSuspend can call java_lang_VirtualThread::set_onWaitingList() while in safepoint

Patricio Chilano Mateo pchilanomate at openjdk.org
Thu Feb 19 17:14:15 UTC 2026


Please review the following patch. `ExitOnSuspend::operator()` may run while a safepoint is in progress, which can lead to crashes because releasing the monitor involves touching oops if the successor is a virtual thread. The proposed fix is to process pending operations before releasing the monitor.
I added a new test that reliably reproduces the issue with the extra `assert_not_at_safepoint()` added in this patch, and verified the issue is now fixed.

Thanks,
Patricio

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

Commit messages:
 - v1

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

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


More information about the serviceability-dev mailing list