Quality Outreach Heads-up - New Loom Early-Access Builds

The OpenJDK Quality Group is promoting the testing of FOSS projects with OpenJDK builds as a way to improve the overall quality of the release. This heads-up is part of a regular communication sent to the projects involved. To learn more about the program, and how-to join, please check here.

New Loom EA Builds Improve Monitors (Synchronized Methods) in Virtual Threads

Project Loom published new early-access builds (23-loom+4-102 - 2024/5/31). They have an improved object monitor implementation that should prevent virtual threads from pinning their carrier thread in the following situations:

  • when blocking on entering a synchronized method/statement because the object’s associated monitor is held by another thread
  • when parking (e.g. when doing socket I/O) while in a synchronized method
  • when calling Object.wait while in a synchronized method

3 potential uses-cases

The changes for Object.wait/timed-wait is the main change since the previous Loom EA build.

The Loom team is looking for help to test the changes, i.e., trying out these builds with code that is known to use virtual threads and with libraries that are “very synchronized”. The primary goal is to gauge both reliability and performance. Right now, the focus is on being functional and reliable. Please note that the performance for some cases isn’t yet fully on par with blocking on j.u.concurrent locks and condition objects.

As before, JFR events can be used to identify remaining cases of pinning, parking or blocking in a class initializer for example. The system property jdk.tracePinnedThreads, which used to print stack traces when threads are pinned, no longer outputs anything.

Please send feedback via e-mail to the Loom mailing list (subscription required).