United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6888573 class data sharing does not always disable large pages
JDK-6888573 : class data sharing does not always disable large pages

Details
Type:
Bug
Submit Date:
2009-10-06
Status:
Closed
Updated Date:
2013-08-09
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
hotspot
OS:
generic
Sub-Component:
runtime
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs16,hs17
Fixed Versions:
hs19 (b04)

Related Reports
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

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
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/1a11430e0326
                                     
2010-06-25
Got rid of test-fail-sharing, this is the only bug affected.
                                     
2013-08-09
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.
                                     
2010-06-15
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.
                                     
2010-06-18



Hardware and Software, Engineered to Work Together