-
Bug
-
Resolution: Fixed
-
P2
-
None
-
None
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JMC-7641 | 8.0.1 | Marcus Hirt | P2 | Resolved | Fixed | |
JMC-7297 | 8.1.0 | Marcus Hirt | P2 | Resolved | Fixed |
As reported on the jmc-dev mailing list (https://mail.openjdk.java.net/pipermail/jmc-dev/2021-April/003530.html) by Tobias Stadler, a ClassCastException can be thrown when opening a heap dump with JOverflow:
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)
He proposes the following fix:
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));
}