[jdk19] Integrated: 8288703: GetThreadState returns 0 for virtual thread that has terminated

Serguei Spitsyn sspitsyn at openjdk.org
Sat Jul 2 05:46:26 UTC 2022


On Fri, 1 Jul 2022 17:47:51 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

> This is fixing the JVM TI GetThreadState issue which returns for terminated virtual thread state = 0 instead of 2 (`JVMTI_THREAD_STATE_TERMINATED`). The problem was in the function `JvmtiEnvBase::get_threadOop_and_JavaThread` which does a check and reurns JVMTI_ERROR_THREAD_NOT_ALIVE a little bit early (before the values of `java_thread` and `thread_oop` are set). This was a root cause of the `GetThreadState` incorrect behavior.

This pull request has now been integrated.

Changeset: 9515560c
Author:    Serguei Spitsyn <sspitsyn at openjdk.org>
URL:       https://git.openjdk.org/jdk19/commit/9515560c54438156b37f1549229bcb5535df5fd1
Stats:     52 lines in 4 files changed: 46 ins; 2 del; 4 mod

8288703: GetThreadState returns 0 for virtual thread that has terminated

Reviewed-by: alanb, amenkov, cjplummer

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

PR: https://git.openjdk.org/jdk19/pull/102


More information about the serviceability-dev mailing list