JDK 23 | Other |
---|---|
23 masterFixed | naResolved |
Cloners :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
JDK-8316691 :
|
ADDITIONAL SYSTEM INFORMATION : Ubunu 22.10 x86_64 openjdk version "21-ea" 2023-09-19 OpenJDK Runtime Environment (build 21-ea+3-124) OpenJDK 64-Bit Server VM (build 21-ea+3-124, mixed mode, sharing) A DESCRIPTION OF THE PROBLEM : HPROF files do not contain stack references of unmounted VirtualThreads. This would be necessary for all analyses based on reachability like biggest objects and dominator trees. The HPROF file format generally supports variable-length HPROF_GC_INSTANCE_DUMP records so the references could be appended to the StackChunk dump. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : With the attached source, create a HPROF file and open it in a HPROF analyser that can show incoming references. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - There should be a reference to the VThreadReferenced instance. ACTUAL - There are no references to the VThreadReferenced instance. ---------- BEGIN SOURCE ---------- -- HprofVThreadStackRef.java --------------------------------------------------------- import com.sun.management.HotSpotDiagnosticMXBean; import java.io.File; import java.lang.management.ManagementFactory; import java.util.concurrent.CountDownLatch; public class HprofVThreadStackRef { public static void main(String[] args) throws Exception { CountDownLatch dumpedLatch = new CountDownLatch(1); Thread vthread = Thread.ofVirtual().start(() -> { Object referenced = new VThreadReferenced(); System.out.println(referenced.getClass()); await(dumpedLatch); System.out.println(referenced.getClass()); }); Thread.sleep(2000); // wait for reference and unmount HotSpotDiagnosticMXBean hotSpotDiagnosticMXBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class); File hprofFile = new File("vthread_test.hprof"); hprofFile.delete(); hotSpotDiagnosticMXBean.dumpHeap(hprofFile.getPath(), true); dumpedLatch.countDown(); vthread.join(); } private static void await(CountDownLatch dumpedLatch) { try { dumpedLatch.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } } public static class VThreadReferenced { } } -------------------------------------------------------------------------------------- ---------- END SOURCE ---------- FREQUENCY : always
|