JDK-6888573 : class data sharing does not always disable large pages
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs16,hs17
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic,x86
  • Submitted: 2009-10-06
  • Updated: 2013-08-09
  • Resolved: 2011-03-07
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 6 JDK 7 Other
6u21pFixed 7Fixed hs19Fixed
Related Reports
Relates :  
Description
Please note that test crashes only when VM uses shared classes.
Here is the VM output:
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/genCollectedHeap.cpp:181
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/tmp/jprt/P2/B/191811.ap31282/source/src/share/vm/memory/genCollectedHeap.cpp:181), pid=2328, tid=2
#  Error: assert(total_reserved % pageSize == 0,"Perm Gen size")
#
# JRE version: 7.0-b73
# Java VM: Java HotSpot(TM) Client VM (17.0-b01-2009-10-03-191811.ap31282.hs-merge-fastdebug mixed mode, sharing solaris-x86 )
# An error report file with more information is saved as:
# /export/local/22430.JDK7.NIGHTLY.VM+solaris-i586_client_mixed_LANG_REGRESSION/results/workDir/java/lang/StringCoding/Enormous/hs_err_pid2328.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#


Here is the link to the failure report:
http://sqeweb.sfbay.sun.com/nfs/results/vm/gtee/JDK7/NIGHTLY/VM/2009-10-03/Main_Baseline/javase/solaris-i586/client/mixed/solaris-i586_client_mixed_LANG_REGRESSION/workDir/java/lang/StringCoding/Enormous/

The hs_err is in the attachment.
In fact,
	java -Xmx128M -version
crashes too (with fast debug build and class data sharing).
To reproduce on a solaris intel:

# Ensure that 4MiB large pages are available:
$ pagesize -a
4096
4194304
# Generate the classes.jsa file with large pages disabled.
$ bin/java -client -XX:+UseSerialGC -Xshare:dump -XX:-UseLargePages
# Run the vm with large page size of 4MiB.
# bin/java -client -XX:+UseSerialGC -XX:+UseLargePages -XX:LargePageSizeInBytes=4m -version

On solaris sparc, a large page size > 4MiB must be used because the default page size is 8K.

Comments
Got rid of test-fail-sharing, this is the only bug affected.
09-08-2013

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/1a11430e0326
25-06-2010

EVALUATION There is code that disables large pages in most, but not all cases, when sharing is used: bool cannot_share = ((UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC || SOLARIS_ONLY(UseISM) NOT_SOLARIS(UseLargePages)); if (cannot_share) { // Either force sharing on by forcing the other options off, or // force sharing off. if (DumpSharedSpaces || ForceSharedSpaces) { jio_fprintf(defaultStream::error_stream(), "Reverting to Serial GC because of %s\n", ForceSharedSpaces ? " -Xshare:on" : "-Xshare:dump"); force_serial_gc(); FLAG_SET_DEFAULT(SOLARIS_ONLY(UseISM) NOT_SOLARIS(UseLargePages), false); ... It's unclear why the code is solaris-specific. Code should be changed to always disable large pages when dumping or using the shared archive.
18-06-2010

EVALUATION If the classes.jsa file is created with LargePageSizeInBytes=n1 (or -XX:-UseLargePages, so n1 == the default page size) and the same VM later run with - class data sharing enabled, - LargePageSizeInBytes=n2, - n1 < n2, - n2 > the min heap granularity required by the card table (2MiB if default page size is 4KiB, 4MiB if default page size is 8KiB) then the heap size is no longer a multiple of the LargePagesize (a requirement) and the assert (and others) will fail. Solaris enables large pages by default, so this is most likely to happen there. On intel boxes, it happens if the large page size supported by the h/w & o/s is 4MiB instead of 2MiB (the default page size is 4KiB and so heap granularity required by the card table is 2MiB). Basically, class data sharing is not large-page aware. CDS should disable large pages when dumping and when using the shared archive.
15-06-2010