JDK-7145358 : SA throws ClassCastException for partially loaded ConstantPool
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris
  • CPU: sparc
  • Submitted: 2012-02-14
  • Updated: 2013-07-18
  • Resolved: 2012-02-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u40Fixed 8Fixed hs24Fixed
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
EVALUATION http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/38fd165da001
22-03-2012

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

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

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"); + } }
14-02-2012