Integrated: 8312498: Thread::getState and JVM TI GetThreadState should return TIMED_WAITING virtual thread is timed parked
Alan Bateman
alanb at openjdk.org
Tue Sep 19 11:00:55 UTC 2023
On Fri, 21 Jul 2023 18:01:45 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.
This pull request has now been integrated.
Changeset: 4461eeb3
Author: Alan Bateman <alanb at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/4461eeb31d5ccc89e304329a7dccb9cb130713fc
Stats: 873 lines in 10 files changed: 697 ins; 57 del; 119 mod
8312498: Thread::getState and JVM TI GetThreadState should return TIMED_WAITING virtual thread is timed parked
Reviewed-by: sspitsyn, rpressler
-------------
PR: https://git.openjdk.org/jdk/pull/14978
More information about the core-libs-dev
mailing list