Sv: ClassCastException when opening heap dump

Marcus Hirt marcus at hirt.se
Tue Apr 20 18:49:41 UTC 2021


Hi Tobias,

Thank you for reporting this! This would make a perfect PR! :)
https://github.com/openjdk/jmc

Let me know if I can help facilitate the process!

I've opened an issue here:
https://bugs.openjdk.java.net/browse/JMC-7246

Kind regards,
Marcus

-----Ursprungligt meddelande-----
Från: jmc-dev <jmc-dev-retn at openjdk.java.net> För Tobias Stadler
Skickat: den 20 april 2021 16:48
Till: jmc-dev at openjdk.java.net
Ämne: ClassCastException when opening heap dump

Hi everyone,

I have a heap dump file which I cannot open in JDK Mission Control. However I can open it in VisualVM.

Here is the exception I am getting:
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class org.openjdk.jmc.joverflow.heap.model.JavaHeapObject (java.lang.Integer is in module java.base of loader 'bootstrap'; org.openjdk.jmc.joverflow.heap.model.JavaHeapObject is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @718ad3a6)
	at org.openjdk.jmc.joverflow.heap.model.Snapshot.getObjectForId(Snapshot.java:208)
	at org.openjdk.jmc.joverflow.heap.model.Snapshot.dereferenceField(Snapshot.java:311)
	at org.openjdk.jmc.joverflow.heap.model.JavaObject.parseFields(JavaObject.java:253)
	at org.openjdk.jmc.joverflow.heap.model.JavaObject.getFields(JavaObject.java:83)
	at org.openjdk.jmc.joverflow.stats.BreadthFirstHeapScanner.scanObjectsFromRootObj(BreadthFirstHeapScanner.java:110)
	at org.openjdk.jmc.joverflow.stats.HeapScaner.analyzeViaAllObjectsEnum(HeapScaner.java:132)
	at org.openjdk.jmc.joverflow.stats.DetailedStatsCalculator.calculate(DetailedStatsCalculator.java:142)
	at org.openjdk.jmc.joverflow.stats.StandardStatsCalculator.calculate(StandardStatsCalculator.java:74)
	at org.openjdk.jmc.joverflow.ui.model.ModelLoader.run(ModelLoader.java:103)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

I am using JDK Mission Control 8.0.0+b13. The heap dump was created JVM running Amazon Corretto 1.8.0_272.

I can open the file with the following diff

diff --git a/application/org.openjdk.jmc.joverflow/src/main/java/org/openjdk/jmc/joverflow/heap/model/Snapshot.java b/application/org.openjdk.jmc.joverflow/src/main/java/org/openjdk/jmc/joverflow/heap/model/Snapshot.java
index 16f56b57..64330571 100644
--- a/application/org.openjdk.jmc.joverflow/src/main/java/org/openjdk/jmc/joverflow/heap/model/Snapshot.java
+++ b/application/org.openjdk.jmc.joverflow/src/main/java/org/openjdk/jmc/joverflow/heap/model/Snapshot.java
@@ -771,7 +771,7 @@ public class Snapshot {
                        }
 
                        // Create fake instance class
-                       return new JavaClass(name, 0, 0, 0, 0, fields, JavaClass.NO_FIELDS, JavaClass.NO_VALUES, instSize,
+                       return new JavaClass(classID, name, 0, 0, 0, 0, fields, JavaClass.NO_FIELDS, JavaClass.NO_VALUES, instSize,
                                        getInMemoryInstanceSize(instSize));
                }
 

Regards Tobias



More information about the jmc-dev mailing list