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

Serguei Spitsyn sspitsyn at openjdk.org
Fri Jul 1 18:01:11 UTC 2022


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.

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

Commit messages:
 - fixed one trailing space issue
 - 8288703: GetThreadState returns 0 for virtual thread that has terminated

Changes: https://git.openjdk.org/jdk19/pull/102/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk19&pr=102&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8288703
  Stats: 51 lines in 3 files changed: 46 ins; 2 del; 3 mod
  Patch: https://git.openjdk.org/jdk19/pull/102.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/102/head:pull/102

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


More information about the serviceability-dev mailing list