United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-8000311 G1: ParallelGCThreads==0 broken
JDK-8000311 : G1: ParallelGCThreads==0 broken

Details
Type:
Bug
Submit Date:
2012-10-01
Status:
Resolved
Updated Date:
2013-04-30
Project Name:
JDK
Resolved Date:
2012-10-05
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs24
Fixed Versions:
hs25 (b04)

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

Sub Tasks

Description
While testing with ParallelGCThreads==0, I ran into the following crash:

2012-10-01T14:32:03.781-0700: 4.018: [GC pause (young)4.029: [SoftReference, 0 refs, 0.0000097 secs]4.029: [WeakReference, 1 refs, 0.0000110 secs]4.029: [FinalReference, 28 refs, 0.0003202 secs]4.029: [PhantomReference, 0 refs, 0.0000061 secs]4.029: [JNI Weak Reference, 0 refs, 0.0000089 secs]#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGFPE (0x8) at pc=0xfe386082, pid=12513, tid=6
#
# JRE version: Java(TM) SE Runtime Environment (7.0-b147)
# Java VM: Java HotSpot(TM) Server VM (25.0-b04-internal-jvmg mixed mode solaris-x86 )
# Problematic frame:
# V  [libjvm.so+0xb86082]  void PLABStats::adjust_desired_plab_sz()+0x182
#
# Core dump written. Default location: /export/GC-TEST-SUITES/gcbasher/core or core.12513
#
# An error report file with more information is saved as:
# /export/GC-TEST-SUITES/gcbasher/hs_err_pid12513.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#
Current thread is 6
Dumping core ...

with the following stack trace:

Stack: [0xe66fe000,0xe677e000],  sp=0xe677d674,  free space=509k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xb86082]  void PLABStats::adjust_desired_plab_sz()+0x182
V  [libjvm.so+0x788e27]  void G1CollectedHeap::release_gc_alloc_regions()+0x57
V  [libjvm.so+0x78b7c3]  void G1CollectedHeap::evacuate_collection_set()+0x503
V  [libjvm.so+0x788297]  bool G1CollectedHeap::do_collection_pause_at_safepoint(double)+0x967
V  [libjvm.so+0xdb2e58]  void VM_G1IncCollectionPause::doit()+0x1b8
V  [libjvm.so+0xdafccd]  void VM_Operation::evaluate()+0x7d
V  [libjvm.so+0xdad7cc]  void VMThread::evaluate_operation(VM_Operation*)+0x9c
V  [libjvm.so+0xdadda0]  void VMThread::loop()+0x4d0
V  [libjvm.so+0xdad401]  void VMThread::run()+0x111
V  [libjvm.so+0xb5d950]  java_start+0x210

during the first GC.
                                    

Comments
SIGFPE is a divide by zero error in the following code:

// Compute desired plab size and latch result for later
// use. This should be called once at the end of parallel
// scavenge; it clears the sensor accumulators.
void PLABStats::adjust_desired_plab_sz() {
  assert(ResizePLAB, "Not set");
  if (_allocated == 0) {
    assert(_unused == 0,
           err_msg("Inconsistency in PLAB stats: "
                   "_allocated: "SIZE_FORMAT", "
                   "_wasted: "SIZE_FORMAT", "
                   "_unused: "SIZE_FORMAT", "
                   "_used  : "SIZE_FORMAT,
                   _allocated, _wasted, _unused, _used));

    _allocated = 1;
  }
  double wasted_frac    = (double)_unused/(double)_allocated;
  size_t target_refills = (size_t)((wasted_frac*TargetSurvivorRatio)/
                                   TargetPLABWastePct);
  if (target_refills == 0) {
    target_refills = 1;
  }
  _used = _allocated - _wasted - _unused;
  size_t plab_sz = _used/(target_refills*ParallelGCThreads);

We end up dividing _used by zero because ParallelGCThreads is zero.
                                     
2012-10-01
Divide by zero when ParallelGCThreads is zero.
                                     
2012-10-01
URL:   http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/2e6857353b2c
User:  johnc
Date:  2012-10-04 20:56:50 +0000

                                     
2012-10-05
URL:   http://hg.openjdk.java.net/hsx/hsx25/hotspot/rev/2e6857353b2c
User:  amurillo
Date:  2012-10-05 22:35:18 +0000

                                     
2012-10-05



Hardware and Software, Engineered to Work Together