RFR: 8306324: StopThread results in thread being marked as interrupted, leading to unexpected InterruptedException
Alan Bateman
alanb at openjdk.org
Thu Jul 17 14:44:48 UTC 2025
On Thu, 17 Jul 2025 12:13:22 GMT, David Holmes <dholmes at openjdk.org> wrote:
> I need to dive into the code tomorrow but I can't help think that doing an actual interrupt is not really what is needed, we just need to unpark the thread if it is blocked ...
I think we also need to step back and write down examples of where JVMTI StopThread is useful. The main use-case may be in the debugger where is suspended at a breakpoint and the user wants to throw an exception to exercise some code path and exception handling. So I think it may be less about wakeup. Also if the target thread is in Object.wait then it can't continue until it re-enters the monitor so it's never been guaranteed to wakeup immediately. Although it may be unpalatable, I think we should look at having StopThread fail in these cases.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26365#issuecomment-3084347073
More information about the serviceability-dev
mailing list