oracle / visualvm

VisualVM is an All-in-One Java Troubleshooting Tool
https://visualvm.github.io/
Other
2.79k stars 297 forks source link

Virtual threads support #462

Open cowwoc opened 1 year ago

cowwoc commented 1 year ago

Is your feature request related to a problem? Please describe. The heap dump produced by VisualVM, and the Thread tab in the UI, do not show virtual threads.

Describe the solution you'd like The heap dump should show virtual threads and their associated stack-trace (e.g. jcmd <pid> Thread.dump_to_file <file>). The Thread UI tab should show virtual threads.

cowwoc commented 1 year ago

Other UX suggestions:

Provide options for the following functionality:

  1. Groups all threads with similar stack-traces (as IntelliJ does).
  2. Sort threads by their runtime duration, to identify potentially stuck/deadlocked threads.
  3. We should be able to reorder threads in an existing dumps, instead of having to generate a new dump (because maybe the process is dead by this point).
cowwoc commented 1 year ago

You can get a list of all virtual threads with a mix of jdk.internal.vm.ThreadContainers and jdk.internal.vm.ThreadContainer.threads() using reflection. I know that invoking private APIs is not ideal, but I don't think there is an alternative at the moment.

Once you have a list of virtual threads, you should be able to include them in heap dumps as well as show the local variables per stack frame.

cowwoc commented 1 year ago

Hi again. Are you planning to work on Virtual Threads now that they are targeted as non-preview for JDK 21, and you just cut a new release of VisualVM?

thurka commented 1 year ago

While reading through the specification JEP 444: Virtual Threads, I filed in the following enhacements: GH-501 GH-502 GH-503 GH-504 GH-507

sureshg commented 3 months ago

Hi, are there any plans to add support for the virtual thread soon?