Java’s virtual threads, introduced in JDK 21 in September 2023 to make it easier to write and maintain concurrent applications, has suffered from a “pinning” issue that arises with synchronized methods or synchronized statements.
Oracle detailed the virtual thread pinning issue this week on the Inside Java website. The two most common cases involve a virtual thread parking while in a synchronized method, and a virtual thread blocking when entering a synchronized method, because the object’s associated monitor is held by another thread. In both cases, the carrier or native thread is not released to do other other work.