JDK-8204308 : SA: serviceability/sa/TestInstanceKlassSize*.java fails when running in CDS mode
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 11,12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-06-05
  • Updated: 2020-01-13
  • Resolved: 2018-08-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 11 JDK 12
11.0.4Fixed 12 b09Fixed
Related Reports
Blocks :  
Duplicate :  
Relates :  
Relates :  
Description
serviceability/sa/TestInstanceKlassSizeForInterface.java fails when running in CDS mode

 stderr: [Exception in thread "main" sun.jvm.hotspot.utilities.AssertionFailure: Invalid bucket id
	at jdk.hotspot.agent/sun.jvm.hotspot.utilities.Assert.that(Assert.java:32)
	at jdk.hotspot.agent/sun.jvm.hotspot.utilities.BasicHashtable.bucket(BasicHashtable.java:62)
	at jdk.hotspot.agent/sun.jvm.hotspot.memory.Dictionary.contains(Dictionary.java:87)
	at jdk.hotspot.agent/sun.jvm.hotspot.oops.InstanceKlass.isShared(InstanceKlass.java:329)
	at jdk.hotspot.agent/sun.jvm.hotspot.oops.InstanceKlass.hasStoredFingerprint(InstanceKlass.java:313)
	at jdk.hotspot.agent/sun.jvm.hotspot.oops.InstanceKlass.getSize(InstanceKlass.java:287)
	at TestInstanceKlassSizeForInterface.SAInstanceKlassSize(TestInstanceKlassSizeForInterface.java:77)
	at TestInstanceKlassSizeForInterface.main(TestInstanceKlassSizeForInterface.java:174)

serviceability/sa/TestInstanceKlassSize.java 

stderr: [Exception in thread "main" sun.jvm.hotspot.utilities.AssertionFailure: Invalid bucket id 
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.Assert.that(Assert.java:32) 
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.BasicHashtable.bucket(BasicHashtable.java:62) 
at jdk.hotspot.agent/sun.jvm.hotspot.memory.Dictionary.contains(Dictionary.java:87) 
at jdk.hotspot.agent/sun.jvm.hotspot.oops.InstanceKlass.isShared(InstanceKlass.java:329) 
at jdk.hotspot.agent/sun.jvm.hotspot.oops.InstanceKlass.hasStoredFingerprint(InstanceKlass.java:313) 
at jdk.hotspot.agent/sun.jvm.hotspot.oops.InstanceKlass.getSize(InstanceKlass.java:287) 
at TestInstanceKlassSize.SAInstanceKlassSize(TestInstanceKlassSize.java:170) 
at TestInstanceKlassSize.main(TestInstanceKlassSize.java:193) 
] 
Comments
Fix Request (11u): Please approve backporting this to OpenJDK 11u. The JDK 12 patch applies mostly, only the hunk for ProblemList.txt didn't apply. Backport patch got reviewed by Aleksey Shipilev and Jiangli Zhou. Tier 1 tests pass, which exercise jhsdb via serviceability tests. There is also an added regression test part of the backport. Risk seems minimal (only SA code changes) and it fixes a real bug in the serviceability agent in JDK 11. RFR: http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2019-May/001091.html webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8204308/01/webrev/
03-05-2019

The proposed fix mimics the code in Symbol::identity_hash() in "src/hotspot/share/oops/symbol.hpp".
24-08-2018

This is reproducible with jhsdb jmap --clstats on a CDS enabled process. The issue is due to 'int' being used instead of 'unsigned int' in Symbol.identityHash() in "src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Symbol.java". 'unsigned int' has been used in the equivalent Symbol::identity_hash() in "src/hotspot/share/oops/symbol.hpp". Since we don't have 'unsigned int' in java, making changes to use 'long' instead.
23-08-2018