-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P4
-
None
-
Affects Version/s: 26
-
Component/s: core-libs
The method could be improve to also dump all threads - including virtual thtreads - to a file.
The HotspotDiagnotiscMBean supports that - for instance:
String file = Path.of("threads.json").toAbsolutePath().toString();
ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
.dumpThreads(file, HotSpotDiagnosticMXBean.ThreadDumpFormat.JSON);
Some investigation might be needed to see if we should create several such files, as printThreads can be called multiple time by a test.
Here is an exanple where a test may cause threads to be printed:
"MainThread" prio=5 Id=26 RUNNABLE
at java.management@26-internal/sun.management.ThreadImpl.dumpThreads0(Native Method)
at java.management@26-internal/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:505)
at java.management@26-internal/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:493)
at app//ReferenceTracker.printThreads(ReferenceTracker.java:221)
at app//ReferenceTracker.check(ReferenceTracker.java:283)
at app//ReferenceTracker.check(ReferenceTracker.java:111)
at app//AbstractThrowingSubscribers.testThrowing(AbstractThrowingSubscribers.java:543)
at app//AbstractThrowingSubscribers.testThrowing(AbstractThrowingSubscribers.java:475)
at app//ThrowingSubscribersAsLimiting.test(ThrowingSubscribersAsLimiting.java:63)
at app//ThrowingSubscribersAsLimitingAsync.test(ThrowingSubscribersAsLimitingAsync.java:48)
The HotspotDiagnotiscMBean supports that - for instance:
String file = Path.of("threads.json").toAbsolutePath().toString();
ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
.dumpThreads(file, HotSpotDiagnosticMXBean.ThreadDumpFormat.JSON);
Some investigation might be needed to see if we should create several such files, as printThreads can be called multiple time by a test.
Here is an exanple where a test may cause threads to be printed:
"MainThread" prio=5 Id=26 RUNNABLE
at java.management@26-internal/sun.management.ThreadImpl.dumpThreads0(Native Method)
at java.management@26-internal/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:505)
at java.management@26-internal/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:493)
at app//ReferenceTracker.printThreads(ReferenceTracker.java:221)
at app//ReferenceTracker.check(ReferenceTracker.java:283)
at app//ReferenceTracker.check(ReferenceTracker.java:111)
at app//AbstractThrowingSubscribers.testThrowing(AbstractThrowingSubscribers.java:543)
at app//AbstractThrowingSubscribers.testThrowing(AbstractThrowingSubscribers.java:475)
at app//ThrowingSubscribersAsLimiting.test(ThrowingSubscribersAsLimiting.java:63)
at app//ThrowingSubscribersAsLimitingAsync.test(ThrowingSubscribersAsLimitingAsync.java:48)
- relates to
-
JDK-8372159 HttpClient SelectorManager thread could be a VirtualThread
-
- In Progress
-
-
JDK-8372198 Avoid closing PlainHttpConnection while holding a lock
-
- In Progress
-