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). Looks good. (Looking at the JMX java.lang.management.ThreadInfo for a Thread, we report a lockName/lockOwnerId/lockOwnerName, so we avoid needing to share the threadObj there.) We could do similar additions in the native heap dumper, some of this may be just as frustrating there. The Thread names containing control characters problem could be handled, and showing threadObj might look like diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index e6315a8e40c..98ee1984f1a 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -506,6 +506,9 @@ void Thread::print_on(outputStream* st, bool print_extended_info) const { if (!is_Java_thread() || !java_lang_VirtualThread::is_instance(JavaThread::cast(this)->vthread())) { osthread()->print_on(st); } + if (is_Java_thread()) { + st->print("threadObj=" INTPTR_FORMAT, p2i(JavaThread::cast(this)->threadObj())); + } } ThreadsSMRSupport::print_info_on(this, st); st->print(" "); But we could do that separately from this PR. ------------- Marked as reviewed by kevinw (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/33659#pullrequestreview-6027070679
