JDK-6465357 : CMS: default choice of NewSize can cause obscure startup failure w/small -Xms
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-08-30
  • Updated: 2010-04-02
  • Resolved: 2006-11-14
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
6u4Fixed 7Fixed hs10Fixed
Related Reports
Relates :  
Relates :  
Description
A change in the default choice of NewSize w/CMS has revealed an
existing day-one bug that can cause a start-up error w/small
initial heap settings:

% $ALT_BOOTDIR/bin/java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Server VM (build 1.5.0-b64, mixed mode)

% $ALT_BOOTDIR/bin/java -server -Xms4m -Xmx128m -XX:+UseConcMarkSweepGC -version
Error occurred during initialization of VM
Too small initial heap for new size specified

% $ALT_BOOTDIR/bin/java -server -Xms4m -XX:NewSize=2m -Xmx128m -XX:+UseConcMarkSweepGC -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Server VM (build 1.5.0-b64, mixed mode)


This becomes somewhat worse with 6.0 where the default settings were changed
to use a larger default NewSize:

% $BOOTDIR/bin/java -version
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b97)
Java HotSpot(TM) Server VM (build 1.6.0-rc-b97, mixed mode)

% $BOOTDIR/bin/java -server -Xms16m -Xmx128m -XX:+UseConcMarkSweepGC -version
Error occurred during initialization of VM
Too small initial heap for new size specified

% $BOOTDIR/bin/java -server -Xms16m -XX:NewSize=8m -Xmx128m -XX:+UseConcMarkSweepGC -version
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b97)
Java HotSpot(TM) Server VM (build 1.6.0-rc-b97, mixed mode)

% $BOOTDIR/bin/java -server -Xms18m  -XX:+UseConcMarkSweepGC -version
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b97)
Java HotSpot(TM) Server VM (build 1.6.0-rc-b97, mixed mode)

Comments
WORK AROUND -XX:NewSize=...
05-10-2006

SUGGESTED FIX Event: putback-to Parent workspace: /net/jano.sfbay/export/disk05/hotspot/ws/main/gc_baseline (jano.sfbay:/export/disk05/hotspot/ws/main/gc_baseline) Child workspace: /net/prt-web.sfbay/prt-workspaces/20061005121000.ysr.bot/workspace (prt-web:/net/prt-web.sfbay/prt-workspaces/20061005121000.ysr.bot/workspace) User: ysr Comment: --------------------------------------------------------- Job ID: 20061005121000.ysr.bot Original workspace: karachi:/net/spot/scratch/ysr/bot Submitter: ysr Archived data: /net/prt-archiver.sfbay/data/archived_workspaces/main/gc_baseline/2006/20061005121000.ysr.bot/ Webrev: http://analemma.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/gc_baseline/2006/20061005121000.ysr.bot/workspace/webrevs/webrev-2006.10.05/index.html Fixed 6459197: ContiguousSpace::block_start() has a bogus assert Fixed 6465357: CMS: default choice of NewSize can cause obscure startup failure w/small -Xms Webrev: http://analemma.sfbay/net/spot/scratch/ysr/bot/webrev For the first bug, we moved the assert to a more appropriate spot. For the second bug, we were faced with two choices: either increase initial_heap_size or decrease NewSize. Because the latter can silently result in a potentially sub-optimal setting (because NewSize is not readjusted unless SurvivorSpaces are empty -- and the latter is not forced by our policy, for example, by promoting all survivors preparatory to expanding the young gen), we decided to go with the former. (In verbose mode a suitable warning is emitted.) Meanwhile, the resizing policy is actively being modified as part of CMS ergonomics at which point this will be revisited. Reviewed by: John Coomes, Jon Masamitsu, Tony Printezis Fix Verified: yes Verification Testing: the command line options in 6465357 Other testing: refworkload w/fastdebug Files: update: src/share/vm/memory/space.cpp update: src/share/vm/runtime/arguments.cpp update: src/share/vm/runtime/arguments.hpp Examined files: 3878 Contents Summary: 3 update 3875 no action (unchanged)
05-10-2006

SUGGESTED FIX ------- arguments.cpp ------- *** /tmp/sccs.HAasoh Mon Oct 2 14:46:09 2006 --- arguments.cpp Mon Oct 2 14:14:00 2006 *************** *** 1069,1074 **** --- 1069,1081 ---- FLAG_SET_DEFAULT(NewRatio, MAX2(NewRatio, new_ratio)); size_t min_new = align_size_up(ScaleForWordSize(min_new_default), os::vm_page_size()); + size_t prev_initial_size = initial_heap_size(); + if (prev_initial_size != 0 && prev_initial_size < min_new+OldSize) { + _initial_heap_size = min_new+OldSize; + warning("Initial heap size increased to " SIZE_FORMAT " M from " + SIZE_FORMAT " M; use -XX:NewSize=... for finer control.", + _initial_heap_size/M, prev_initial_size/M); + } // MaxHeapSize is aligned down in collectorPolicy size_t max_heap = align_size_down(MaxHeapSize, CardTableRS::ct_max_alignment_constraint());
29-09-2006

SUGGESTED FIX Default choice of NewSize should be cognizant of -Xms setting (as it currently is of Xmx).
30-08-2006

EVALUATION Yes, this should be fixed. This is not a "conceptual regression" (in the sense that the same bug existed in all older JVM's), however it's a technical regression since a command-line that succeeded with an older JVM can now fail with the new JVM, to wit any Xms value between the old default choice and the new default choice will flag as a technical regression. There is however a workaround which is to explicitly specify NewSize. Because of the fact that this is not a "conceptual" regression, and because of the existence of a workaround, it would appear as though we can wait for 6u1 (and appropriate 5uX) release to fix this. As a result I am inclined to target this to 6u1 and 7.0.
30-08-2006