JDK-6472335 : Allocation of huge array which would cause OutOfMemoryError causes JVM to hang with -Xincgc
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,solaris
  • CPU: generic,sparc
  • Submitted: 2006-09-19
  • Updated: 2012-03-22
  • 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 Availabitlity Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7 Other
1.4.2_14,hs10Fixed 6Fixed 7Fixed hs10Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
The following simple program when run with -Xincgc (or with -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode) causes JVM to hang.

public class Allocate {
        public static void main(String[] args) {
                int size = Integer.parseInt(args[0]);
                int[] arr = new int[size];

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/prt-workspaces/20060922160805.ysr.bot/workspace (prt-web:/net/prt-web/prt-workspaces/20060922160805.ysr.bot/workspace) User: ysr Comment: --------------------------------------------------------- Job ID: 20060922160805.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/20060922160805.ysr.bot/ Webrev: http://analemma.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/gc_baseline/2006/20060922160805.ysr.bot/workspace/webrevs/webrev-2006.09.22/index.html Fixed 6472335: Allocation of huge array which would cause OutOfMemoryError causes JVM to hang with -Xincgc. Webrev: http://analemma.sfbay/net/spot/scratch/ysr/bot/webrev A predicate computation in CMSGen::allocation_limit_reached() was overflowing. This day-one bug was unmasked because of the recent (b92) fix for CR 6415406. Reviewed by: Andrey Petrusenko Fix Verified: yes Verification Testing: test in bug report Other testing: PRT & refworload �� incgc �� concgc Files: update: src/share/vm/memory/concurrentMarkSweepGeneration.cpp Examined files: 3878 Contents Summary: 1 update 3877 no action (unchanged)

EVALUATION The fix should be backported to 6u1, 5u10 and any other update release to which 6415406 has been backported.

WORK AROUND None known, except to not use -Xincgc, instead using -Xconcgc (i.e. the non-incremental version of CMS).

SUGGESTED FIX --- For diffs, see PRT webrev below ---

EVALUATION The changes in 6415406 have unmasked a long-standing bug in CMSCollector::allocation_limit_reached() which does not correctly account for the possibility of arithmetic overflow when doing range / threshold-crossing checks involving large allocation requests.