On Wed, 29 Nov 2023 22:22:09 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:
> There is a check for virtual thread liveness which has to be good enough in > general: > > ``` > 1617 static bool should_dump_vthread(oop vt) { > 1618 return java_lang_VirtualThread::state(vt) != > java_lang_VirtualThread::NEW > 1619 && java_lang_VirtualThread::state(vt) != > java_lang_VirtualThread::TERMINATED; > 1620 } > . . . > 1919 if (java_lang_VirtualThread::is_instance(o) && > ThreadDumper::should_dump_vthread(o)) { > 1920 _vthread_dumper->dump_vthread(o, writer()); > 1921 } > ``` That should in general take care of most unreachable virtual threads, but technically I don't think a virtual thread has to reach the TERMINATED state in order to become unreachable. However, it will never get scheduled. ------------- PR Comment: https://git.openjdk.org/jdk/pull/16665#issuecomment-1833132940