RFR: 8325187: JVMTI GetThreadState says virtual thread is JVMTI_THREAD_STATE_INTERRUPTED when it no longer is [v10]
Serguei Spitsyn
sspitsyn at openjdk.org
Thu Mar 14 19:12:57 UTC 2024
> Please, review this fix correcting the JVMTI `RawMonitorWait()` implementation.
> The `RawMonitorWait()` is using the the `jt->is_interrupted(true)` to update the interrupt status of the interrupted waiting thread. The issue is that when it calls `jt->is_interrupted(true)` to fetch and clear the `interrupt status` of the virtual thread, this information is not propagated to the `java.lang.Thread` instance.
> In the `VirtualThread` class implementation the `interrupt status` for virtual thread is stored for both virtual and carrier threads. It is because the implementation of object monitors for virtual threads is based on pinning virtual threads, and so, always operates on carrier thread. The fix is to clear the interrupt status for both virtual and carrier `java.lang.Thread` instances.
>
> Testing:
> - tested with new test `hotspot/jtreg/serviceability/jvmti/vthread/InterruptRawMonitor` which is passed with the fix and failed without it
> - ran mach5 tiers 1-6
Serguei Spitsyn has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
- Merge
- Merge
- review: dropped the catch of InterruptedException in Object.wait
- optimize holding the interruptLock in JavaThread::is_interrupted
- reordered JavaThread::is_interrupted code to use lock when needed only
- removed trailing spaces in javaClasses.cpp and libInterruptRawMonitor.cpp
- review: added ObjectLocker of interruptLock for sync
- review: improved sync in new test InterruptRawMonitor
- review: addressed a couple of comments on new test
- fix trailing space in libInterruptRawMonitor.cpp
- ... and 1 more: https://git.openjdk.org/jdk/compare/86a4542e...b13d9c51
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/18093/files
- new: https://git.openjdk.org/jdk/pull/18093/files/df3b6383..b13d9c51
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=18093&range=09
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=18093&range=08-09
Stats: 16508 lines in 443 files changed: 9214 ins; 5600 del; 1694 mod
Patch: https://git.openjdk.org/jdk/pull/18093.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/18093/head:pull/18093
PR: https://git.openjdk.org/jdk/pull/18093
More information about the hotspot-runtime-dev
mailing list