RFR: JDK-8310584: GetThreadState reports blocked and runnable for pinned suspended virtual threads
David Holmes
dholmes at openjdk.org
Fri Jul 14 21:35:13 UTC 2023
On Fri, 14 Jul 2023 18:30:21 GMT, Alex Menkov <amenkov at openjdk.org> wrote:
>> src/hotspot/share/prims/jvmtiEnvBase.cpp line 804:
>>
>>> 802: if (ext_suspended && ((state & JVMTI_THREAD_STATE_ALIVE) != 0)) {
>>> 803: state |= JVMTI_THREAD_STATE_SUSPENDED;
>>> 804: }
>>
>> One question unrelated to this bug and your fix.
>> I wonder if any check and handling is needed for the case:
>> `if (ext_suspended && ((state & JVMTI_THREAD_STATE_ALIVE) == 0))`
>> Not sure this condition is even possible. But do we need to add an assert here?
>
> AFAIU it's possible in the case when we have terminated VT and JvmtiVTSuspender is requested to suspend all virtual threads
So there is a window in which a VT is marked as terminated yet is still visible for actions like this? For regular threads we would always have filtered out thread in the process of exiting. Seeing terminated threads seems potentially problematic but perhaps all the VT code is prepared to handle this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14878#discussion_r1264190561
More information about the serviceability-dev
mailing list