JDK-6978300 : G1: debug builds crash if ParallelGCThreads==0
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs19,7
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2010-08-19
  • Updated: 2013-09-18
  • Resolved: 2010-12-21
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
6u25Fixed 7Fixed hs19Resolved
Related Reports
Duplicate :  
Relates :  
Description
A debug build with -XX:+UseG1GC -XX:ParallelGCThreads=0 will crash during the first GC due to a null pointer dereference.

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/8e5955ddf8e4
25-08-2010

SUGGESTED FIX diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2753,7 +2753,7 @@ print_taskqueue_stats_hdr(st); TaskQueueStats totals; - const int n = MAX2(workers()->total_workers(), 1); + const int n = workers() != NULL ? workers()->total_workers() : 1; for (int i = 0; i < n; ++i) { st->print("%3d ", i); task_queue(i)->stats.print(st); st->cr(); totals += task_queue(i)->stats; @@ -2764,7 +2764,7 @@ } void G1CollectedHeap::reset_taskqueue_stats() { - const int n = MAX2(workers()->total_workers(), 1); + const int n = workers() != NULL ? workers()->total_workers() : 1; for (int i = 0; i < n; ++i) { task_queue(i)->stats.reset(); }
19-08-2010

EVALUATION The fix for 6966222 enabled collection of taskqueue statistics by default in debug builds. This crashes when ParallelGCThreads==0 because it dereferences the _workers member (inherited from SharedHeap), which is null. Must check whether _workers is null before dereferencing it in print_taskqueue_statistics() and reset_taskqueue_statistics().
19-08-2010