RFR: 8373366: HandshakeState should disallow suspend ops for disabler threads
Serguei Spitsyn
sspitsyn at openjdk.org
Wed Dec 10 10:26:26 UTC 2025
This update fixes the following problem. The function JavaThread::java_suspend has the following assert:
bool JavaThread::java_suspend(bool register_vthread_SR) {
// Suspending a vthread transition disabler can cause deadlocks.
assert(!is_vthread_transition_disabler(), "no suspend allowed for vthread transition disablers");
. . .
This is an over-hard requirement/invariant for threads that execute JVMTI functions (e.g. in an agent event handler). Such threads need a chance to be eventually suspended after JVMTI function completes its work and its `mountUnmountDisabler` is destructed.
A more adequate approach is to tweak the function
`HandshakeOperation* HandshakeState::get_op_for_self(bool allow_suspend, bool check_async_exception)`
so it could skip a `HandshakeOperation` if `_handshakee->is_vthread_transition_disabler() == true`, so the same temporary suspension disabling mechanism would be used as for `_handshakee->is_disable_suspend() == true`.
Testing:
- In progress: mach5 tiers 1-6
-------------
Commit messages:
- 8373366: HandshakeState should disallow suspend ops for disabler threads
Changes: https://git.openjdk.org/jdk/pull/28740/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28740&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8373366
Stats: 13 lines in 4 files changed: 2 ins; 2 del; 9 mod
Patch: https://git.openjdk.org/jdk/pull/28740.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28740/head:pull/28740
PR: https://git.openjdk.org/jdk/pull/28740
More information about the hotspot-runtime-dev
mailing list