I add the testcase which can reproduce the crash. I hope that I could get some advise if the codes need changing.
------------- Commit messages: - 8337331: crash: pinned virtual thread will lead to jvm crash when running with the javaagent option Changes: https://git.openjdk.org/jdk/pull/20373/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20373&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8337331 Stats: 135 lines in 3 files changed: 135 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/20373.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/20373/head:pull/20373 PR: https://git.openjdk.org/jdk/pull/20373