United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6559289 CMS assertions wrongly assume markFromRoots() succeeds.
JDK-6559289 : CMS assertions wrongly assume markFromRoots() succeeds.

Details
Type:
Bug
Submit Date:
2007-05-18
Status:
Resolved
Updated Date:
2010-11-17
Project Name:
JDK
Resolved Date:
2007-08-01
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P5
Resolution:
Fixed
Affected Versions:
1.4.2_14
Fixed Versions:
1.4.2_18 (b06)

Related Reports
Backport:

Sub Tasks

Description
Reviewing changes for 6409002 (part of 4615723) I noticed two assertions don't account for the return value of markFromRoots().  It would seem very unlikely, and only in a debug version, but there is a chance to incorrectly trigger an assertion.

If this ever happens, the assertion will be "Collector state should have changed".

                                    

Comments
EVALUATION

My fault.
                                     
2007-05-18
SUGGESTED FIX

)$ sccs diffs -C concurrentMarkSweepGeneration.cpp

------- concurrentMarkSweepGeneration.cpp -------
*** /tmp/dpta4qU        2007-05-18 10:46:00.602205948 +0100
--- concurrentMarkSweepGeneration.cpp   2007-05-16 18:23:36.847287000 +0100
***************
*** 1776,1784 ****
        break;
        case Marking:
        // initial marking in checkpointRootsInitialWork has been completed
!         markFromRoots(true);
!       assert(_collectorState == Precleaning, "Collector state should "
!         "have changed");
        break;
        case Precleaning:
        // marking from roots in markFromRoots has been completed
--- 1776,1787 ----
        break;
        case Marking:
        // initial marking in checkpointRootsInitialWork has been completed
!       if (markFromRoots(true)) { // we were successful
!         assert(_collectorState == Precleaning, "Collector state should "
!           "have changed");
!       } else {
!         assert(_foregroundGCIsActive, "Internal state inconsistency");
!       }
        break;
        case Precleaning:
        // marking from roots in markFromRoots has been completed
***************
*** 1932,1945 ****
        break;
        case Marking:
        // initial marking in checkpointRootsInitialWork has been completed
!         if (VerifyDuringGC &&
!             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
!           Universe::verify(true);
!         }
!         markFromRoots(false);
!       assert(_collectorState == FinalMarking, "Collector state should "
          "have changed");
        break;
        case FinalMarking:
          if (VerifyDuringGC &&
              GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
--- 1935,1950 ----
        break;
        case Marking:
        // initial marking in checkpointRootsInitialWork has been completed
!       if (VerifyDuringGC &&
!           GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
!         Universe::verify(true);
!       }
!       {
!       bool res = markFromRoots(false);
!       assert(res && _collectorState == FinalMarking, "Collector state should "
          "have changed");
        break;
+       }
        case FinalMarking:
          if (VerifyDuringGC &&
              GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
                                     
2007-05-18
EVALUATION

sync from 1.4.2_17-rev.
                                     
2008-12-22



Hardware and Software, Engineered to Work Together