RFR: 8306324: StopThread results in thread being marked as interrupted, leading to unexpected InterruptedException [v7]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Fri Aug 1 14:09:04 UTC 2025
On Fri, 1 Aug 2025 09:40:51 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> src/hotspot/share/prims/jvm.cpp line 2899:
>>
>>> 2897: // An asynchronous exception could have been thrown on
>>> 2898: // us while we were sleeping. We do not overwrite those.
>>> 2899: if (!HAS_PENDING_EXCEPTION) {
>>
>> Maybe not for this bug but we have this `HAS_PENDING_EXCEPTION` check here and further up but I don't see how we can have a pending exception when calling this method. Based on the comment here seems we just wanted to check the async ones as added now.
>
> Should we always have `HAS_PENDING_EXCEPTION == true` if async exception was installed?
> If so, then this newly added check is not really needed:
>
> if (!thread->has_async_exception_condition()) {
Until we process the async exception handshake operation, `HAS_PENDING_EXCEPTION` will be false. The only way for `HAS_PENDING_EXCEPTION` to be true would be if we already entered the method with a pending exception, but I don’t see how that is possible.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26365#discussion_r2248080447
More information about the serviceability-dev
mailing list