RFR: 8307153: JVMTI GetThreadState on carrier should return STATE_WAITING [v2]
Alex Menkov
amenkov at openjdk.org
Tue Jun 6 21:25:56 UTC 2023
On Mon, 5 Jun 2023 19:00:49 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> When a virtual thread is mounted, the carrier thread should be reported as "waiting" until the virtual thread unmounts. Right now, GetThreadState reports a state based the JavaThread status when it should return JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY.
>> The fix adds:
>> - a special case for passive carrier threads
>> - necessary test coverage to the existing JVMTI test: `serviceability/jvmti/vthread/ThreadStateTest`.
>>
>> Testing:
>> - tested with the updated test: `serviceability/jvmti/vthread/ThreadStateTest`
>> - submitted mach5 tiers 1-5
>> - TBD: to submit mach5 tier 6
>
> Serguei Spitsyn has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>
> - Merge
> - minor tweaks in libThreadStateTest.cpp
> - 8307153: JVMTI GetThreadState on carrier should return STATE_WAITING
src/hotspot/share/prims/jvmtiEnvBase.cpp line 764:
> 762:
> 763: if (is_passive_carrier_thread(jt, thread_oop)) {
> 764: state |= (JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY);
Not sure I understand this.
I'd expect
`JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY` to be returned in the case.
How can a thread be JVMTI_THREAD_STATE_RUNNABLE and JVMTI_THREAD_STATE_WAITING at the same time?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14298#discussion_r1220384120
More information about the hotspot-dev
mailing list