United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6910182 CMS: assert(_cursor[j] == _survivor_plab_array[j].end(),"Ctl pt invariant")
JDK-6910182 : CMS: assert(_cursor[j] == _survivor_plab_array[j].end(),"Ctl pt invariant")

Details
Type:
Bug
Submit Date:
2009-12-14
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs17
Fixed Versions:
hs18 (b01)

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

Sub Tasks

Description
The test in attachment could cause CMS crash with assertion:

# after -XX: or in .hotspotrc:  SuppressErrorAt=/concurrentMarkSweepGeneration.cpp:5362
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/BUILD_AREA/jdk7/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp:5362), pid=23504, tid=2865970064
#  Error: assert(_cursor[j] == _survivor_plab_array[j].end(),"Ctl pt invariant")
#
# JRE version: 7.0-b77
# Java VM: Java HotSpot(TM) Server VM (17.0-b05-fastdebug mixed mode linux-x86 )
# An error report file with more information is saved as:
# /home/lm153972/ws/cms/file/hs_err_pid23504.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#
Current thread is 2865970064
Dumping core ...


I appeares on the 32bit linux:
java -version:
java version "1.7.0-ea-fastdebug"
Java(TM) SE Runtime Environment (build 1.7.0-ea-fastdebug-b77)
Java HotSpot(TM) Server VM (build 17.0-b05-fastdebug, mixed mode)

I run it with reduced YoungGen (to provoke CMS) like below: 
/net/vmsqe.russia/export/jdk/7/build/latest/linux-i586/fastdebug/bin/java -server -Xmn200K  -XX:+PrintGCDetails  -XX:+UseConcMarkSweepGC crash_concurrentMarkSweepGeneration_5362  | grep -v ParNew

It does not crash each time sometimes.

                                    

Comments
EVALUATION

See display#2 of Comments field.
                                     
2009-12-14
SUGGESTED FIX

Here's a hack. The real fix might want to be more hygienic and principled:-

diff -r 7bfd295ec074 src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp       Tue Dec 08 15:12:17 2009 -0800
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp       Mon Dec 14 14:45:10 2009 -0800
@@ -709,8 +709,11 @@ CMSCollector::CMSCollector(ConcurrentMar
 
   // Support for parallelizing survivor space rescan
   if (CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) {
-    size_t max_plab_samples = cp->max_gen0_size()/
-                                ((SurvivorRatio+2)*MinTLABSize);
+    const size_t max_surv_size =
+      ((DefNewGeneration*)_young_gen)->
+            compute_survivor_size(_young_gen->max_capacity(),
+                                  cp->min_alignment());
+    const size_t max_plab_samples = max_surv_size/MinTLABSize;
     _survivor_plab_array  = NEW_C_HEAP_ARRAY(ChunkArray, ParallelGCThreads);
     _survivor_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, 2*max_plab_samples);
     _cursor               = NEW_C_HEAP_ARRAY(size_t, ParallelGCThreads);
diff -r 7bfd295ec074 src/share/vm/memory/defNewGeneration.hpp
--- a/src/share/vm/memory/defNewGeneration.hpp  Tue Dec 08 15:12:17 2009 -0800
+++ b/src/share/vm/memory/defNewGeneration.hpp  Mon Dec 14 14:45:10 2009 -0800
@@ -136,6 +136,7 @@ protected:
     MinFreeScratchWords = 100
   };
 
+ public:  // Temporary
   // Return the size of a survivor space if this generation were of size
   // gen_size.
   size_t compute_survivor_size(size_t gen_size, size_t alignment) const {
                                     
2009-12-14
SUGGESTED FIX

New suggested fix:

--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -723,8 +723,9 @@ CMSCollector::CMSCollector(ConcurrentMar

   // Support for parallelizing survivor space rescan
   if (CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) {
-    size_t max_plab_samples = cp->max_gen0_size()/
-                                ((SurvivorRatio+2)*MinTLABSize);
+    const size_t max_plab_samples =
+      ((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize;
+
     _survivor_plab_array  = NEW_C_HEAP_ARRAY(ChunkArray, ParallelGCThreads);
     _survivor_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, 2*max_plab_samples);
     _cursor               = NEW_C_HEAP_ARRAY(size_t, ParallelGCThreads);
                                     
2010-02-26
EVALUATION

ChangeSet=http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/d47555d7aca8,ChangeRequest=6910182
                                     
2010-03-03



Hardware and Software, Engineered to Work Together