RFR: 8312498: Thread::getState and JVM TI GetThreadState should return TIMED_WAITING virtual thread is timed parked [v3]

Ron Pressler rpressler at openjdk.org
Mon Sep 18 09:30:47 UTC 2023


On Thu, 14 Sep 2023 13:30:28 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Thread::getState is an API for monitoring and management purposes to report the thread state. If a virtual thread is parked with LockSupport.parkNanos, its state is reported as  WAITING when it should be TIMED_WAITING. JVM TI GetThreadState has the same issue in that it returns JVMTI_THREAD_STATE_WAITING_INDEFINITELY instead of the JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT bit set. Not a very visible issue with debuggers because JDWP maps both states to "WAIT" but it may be noticed by tools using other JVM TI agents.
>> 
>> The change is straight-forward with additional state for timed-parking/parked/pinned. The existing virtual/ThreadAPI.java test is expanded to this scenario. A new test is added for JVM TI GetThreadState to test waiting/timed-waited cases (including pinned) as test coverage seems patchy here.
>
> Alan Bateman 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 14 additional commits since the last revision:
> 
>  - Merge
>  - Revert back to explicit TIMED_xxx states
>  - Merge
>  - Merge
>  - Merge
>  - Remove unecessary RF from test
>  - Merge
>  - Merge
>  - Remove tab
>  - Cleanup comments
>  - ... and 4 more: https://git.openjdk.org/jdk/compare/9f4b9cea...70b7766d

Marked as reviewed by rpressler (Committer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/14978#pullrequestreview-1630626956


More information about the serviceability-dev mailing list