Paul Krill
Editor at Large

Java virtual threads hit with pinning issue

news
Feb 22, 20242 mins

The Java team at Oracle is working to address two common cases in which a virtual thread parks or blocks and the underlying native thread is not released.

shutterstock 365534981 closeup of colorful sewing threads on spools
Credit: Oksana Shufrych / Shutterstock

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. Virtual thread pinning could impact performance and scalability and potentially result in starvation and deadlock, according to the blog post.

New early access builds for Java’s Project Loom introduce changes to the object monitor implementation that do not pin in these two common cases. The Loom team is seeking help from users to test the reliability and performance of these updated object monitors with code that uses virtual threads and with libraries that are heavily synchronized. To report an issue, developers should use the Loom mailing list.

Project Loom is the OpenJDK project that develops JVM features and APIs to support lightweight concurrency. Previewed in JDK 19 and JDK 20, virtual threads are lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications, according to Oracle. Despite the pinning issue, Oracle said virtual threads have been extremely well-received by the Java community and ecosystem.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author