On Fri, 1 Mar 2024 23:26:48 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:
> 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 This pull request has now been integrated. Changeset: 6eea5d67 Author: Serguei Spitsyn <sspit...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/6eea5d675566adca3fca88639008c6c0221450a4 Stats: 209 lines in 7 files changed: 205 ins; 1 del; 3 mod 8325187: JVMTI GetThreadState says virtual thread is JVMTI_THREAD_STATE_INTERRUPTED when it no longer is Reviewed-by: dholmes, alanb ------------- PR: https://git.openjdk.org/jdk/pull/18093