RFR: 8325187: JVMTI GetThreadState says virtual thread is JVMTI_THREAD_STATE_INTERRUPTED when it no longer is [v2]

David Holmes dholmes at openjdk.org
Tue Mar 5 23:13:47 UTC 2024


On Tue, 5 Mar 2024 19:57:39 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

> The behavior of ObjectMonitor::wait and RawMonitorWait is different.
The Object.wait() throws the InterruptedException if it was interrupted. The RawMonitorWait clears the thread interrupt status and returns the error code JVMTI_ERROR_INTERRUPT.

That is not a significant/relevant difference as far as I can see. They both call `thread->is_interrupted(true)`.

> For Object.wait, the clearing of the interrupt status is done in the Java code, 

Okay so that is where the carrier and virtual thread states get back in sync, and that is what is missing in the `RawMonitorWait` case. The proposed fix/change to `is_interrupted` is what threw me as that is the wrong place to make a change because it affects both cases. What is missing is an upcall from `RawMonitorWait` to some Java code to do the same job as the `Object.wait` Java code does.

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

PR Comment: https://git.openjdk.org/jdk/pull/18093#issuecomment-1979794228


More information about the serviceability-dev mailing list