JDK-8302184 : full lock information for virtual threads in thread dumps
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: tools
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2023-02-10
  • Updated: 2025-05-24
  • Resolved: 2025-05-24
Related Reports
Duplicate :  
Relates :  
Description
We need a guaranteed way to easily account for all held locks in the application, exactly what any threads that hold them are doing, and identify what code / threads are waiting on them. Whatever way this is done needs to be simple, built into the runtime, and produce output that can be easily shared for off-line analysis. Information for both intrinsic monitors as well as j.u.c locks (if enabled) is required.

This is currently possible for platform threads (via a normal thread dump), but not virtual threads. This represents a severe regression in serviceability for any user of virtual threads.

Adding the needed lock information to the implementation of Thread.dump_to_file should be sufficient (given that all threads are tracked).
Comments
The update in JDK-8356870 to the thread dump generated by jcmd Thread.dump_to_file include extending information on locks, both object monitor and parkPark/ownable-synchronizers.
24-05-2025

[~mwthomps] We've been planning to add lock information (both monitor and ownable synchronizer) to the thread dump for some time. You can assign this issue to me if you want and I'll close it once it there is a refresh in the main line.
18-02-2023

Targeted to JDK 21 for evaluation
17-02-2023