The latest JDK 26 EA builds [1] now include the changes from JDK-8369238 [2]. With this update, a virtual thread that tries to initialize a class already being initialized by another thread will, in most cases, be unmounted from its carrier while waiting. Previously, the virtual thread would remain pinned to its carrier while waiting for the other thread to execute the class initializer.

This will help avoid pathological cases that can lead to deadlocks, in particular, those where all carriers are pinned by virtual threads waiting for another thread to execute a class initializer, while the thread executing the class initializer blocks or waits on something that requires a virtual thread to execute.

For now, the changes address the most common initialization paths described in JDK-8369238, but this might be extended in the future. As such, testing and feedback would be greatly appreciated, especially for those who have run into this issue on real-world applications.

Thanks,
Patricio

[1] https://jdk.java.net/26/
[2] https://bugs.openjdk.org/browse/JDK-8369238

Reply via email to