On Sat, 31 Oct 2026 14:37:51 GMT, Alan Bateman <[email protected]> wrote:

> This is an update to the thread dump generated by 
> HotSportDiagnosticMXBean.dumpThreads and the jcmd equivalent.
> 
> 1. The thread output is updated to include the identity string of the Thread 
> object to make it easier link a Thread.join usage to the target thread.
> 2. The parkBlocker is now set when parked in StructuredTaskScope.join parks 
> to make it easier to find the STS in the thread dump.
> 3. The thread CPU time is now included for platform threads when available.
> 4. The JSON dump escapes forward slash between the module and class name in 
> the stack traces. Escaping of this character is optional and dropped, as it 
> was annoying.
> 5. The escaping fails if a thread name contains a control character.
> 
> Testing: tier1-3
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This all looks okay to me - not familiar with all of the code in depth but it 
looks okay. A couple of comments/suggestions.

Thanks

src/java.base/share/classes/jdk/internal/vm/ThreadDumper.java line 189:

> 187:         writer.println("#" + thread.threadId() + " \"" + 
> escape(snapshot.threadName())
> 188:                 + "\" " + (thread.isVirtual() ? "virtual " : "")
> 189:                 + Objects.toIdentityString(thread) +

I still think `decorateObject` might be preferable here.

test/jdk/com/sun/management/HotSpotDiagnosticMXBean/DumpThreads.java line 667:

> 665:             ThreadDump.ThreadInfo ti = threadDump.rootThreadContainer()
> 666:                     .findThread(joinerTid)
> 667:                     .orElse(null);

Suggestion:

            ThreadDump.ThreadInfo ti = threadDump.rootThreadContainer()
                                                 .findThread(joinerTid)
                                                 .orElse(null);

test/jdk/com/sun/management/HotSpotDiagnosticMXBean/DumpThreads.java line 671:

> 669: 
> 670:             // Compiled native frames have no locals. If Object.wait0 
> has been compiled
> 671:             // then we may not have the object that the thread is 
> waiting on.

Even when using compiled code we always know which object a monitor that is 
being waited-upon belongs to.

-------------

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/33659#pullrequestreview-6032482682
PR Review Comment: https://git.openjdk.org/jdk/pull/33659#discussion_r4674530259
PR Review Comment: https://git.openjdk.org/jdk/pull/33659#discussion_r4674607592
PR Review Comment: https://git.openjdk.org/jdk/pull/33659#discussion_r4674626487

Reply via email to