RFR: 8306324: StopThread results in thread being marked as interrupted, leading to unexpected InterruptedException [v3]
Serguei Spitsyn
sspitsyn at openjdk.org
Wed Jul 30 07:30:54 UTC 2025
On Tue, 29 Jul 2025 23:45:09 GMT, David Holmes <dholmes at openjdk.org> wrote:
> I don't think the current proposed change (which drop's setting the interrupt flag in install_async_exception) will cause a target thread blocked in sleep to wakeup. A target thread blocked in JavaThread::sleep_nanos will wakeup from park_nanos but will just park again with the remaining time.
Thank you checking this. I've restored the tweak in the `JavaThread::sleep_nanos()`.
> I assume this is the test failures that Serguei mentions.
The test failures I mentioned were after an attempt to remove the following lines from the `JavaThread::install_async_exception()`:
oop vt_oop = vthread();
if (vt_oop == nullptr || !vt_oop->is_a(vmClasses::BaseVirtualThread_klass())) {
// Interrupt thread so it will wake up from a potential wait()/sleep()/park()
this->interrupt();
}
```
In order to remove the above a corresponding update in the jdwp/debugger is additionally needed to invoke the JVMTI `ThreadInterrupt()`.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26365#issuecomment-3135163510
More information about the serviceability-dev
mailing list