United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7145358 SA throws ClassCastException for partially loaded ConstantPool
JDK-7145358 : SA throws ClassCastException for partially loaded ConstantPool

Details
Type:
Bug
Submit Date:
2012-02-14
Status:
Closed
Updated Date:
2013-07-18
Project Name:
JDK
Resolved Date:
2012-02-27
Component:
hotspot
OS:
solaris
Sub-Component:
svc
CPU:
sparc
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs24 (b01)

Related Reports
Backport:
Backport:
Backport:

Sub Tasks

Description
SA throws java.lang.ClassCastException while dumping the contents of a partially loaded constantPoolOopDesc instance in the PermGen.

hsdb> inspect 0x6046e57b0
Error: java.lang.ClassCastException: sun.jvm.hotspot.oops.ConstantPool cannot be cast to sun.jvm.hotspot.oops.Klass
java.lang.ClassCastException: sun.jvm.hotspot.oops.ConstantPool cannot be cast to sun.jvm.hotspot.oops.Klass
        at sun.jvm.hotspot.oops.ConstantPool.getPoolHolder(ConstantPool.java:122)
        at sun.jvm.hotspot.oops.ConstantPool.printValueOn(ConstantPool.java:651)
        at sun.jvm.hotspot.oops.Oop.printOopValueOn(Oop.java:186)
        at sun.jvm.hotspot.ui.tree.OopTreeNodeAdapter.getValue(OopTreeNodeAdapter.java:107)
        at sun.jvm.hotspot.CommandProcessor$18.doit(CommandProcessor.java:793)
        at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1700)
        at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1670)
        at sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:1550)
        at sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:91)
        at sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:35)

hsdb> mem 0x6046e57b0 10
0x00000006046e57b0: 0x0000000000000001
0x00000006046e57b8: 0x00000000c0800308
0x00000006046e57c0: 0x00000006046e5908
0x00000006046e57c8: 0x0000000000000000
0x00000006046e57d0: 0x00000006046e57b0 << pool_holder pointing to self
0x00000006046e57d8: 0x0000000000000000
0x00000006046e57e0: 0x0000002300000000
0x00000006046e57e8: 0x0000000000000001
0x00000006046e57f0: 0x0000000000000000
0x00000006046e57f8: 0x00002aaab40952f1

                                    

Comments
SUGGESTED FIX

agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java    Thu
Dec 29 15:14:33 2011 -0800
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java    Fri
Dec 30 20:15:10 2011 +0800
@@ -648,7 +648,12 @@
   }

   public void printValueOn(PrintStream tty) {
-    tty.print("ConstantPool for " + getPoolHolder().getName().asString());
+    Oop holder = poolHolder.getValue(this);
+    if (holder instanceof Klass) {
+      tty.print("ConstantPool for " + ((Klass)
holder).getName().asString());
+    } else {
+      tty.print("ConstantPool for partially loaded class");
+    }
   }
                                     
2012-02-14
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/38fd165da001
                                     
2012-02-21
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-main/hotspot/rev/38fd165da001
                                     
2012-02-22
EVALUATION

http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/38fd165da001
                                     
2012-03-22



Hardware and Software, Engineered to Work Together