United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6895236 CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
JDK-6895236 : CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")

Details
Type:
Bug
Submit Date:
2009-10-26
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs17
Fixed Versions:

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
Does not fail if you use the following flags instead:-
... -XX:+CMSClassUnloadingEnabled -XX:+ExplicitGCInvokesConcurret

Started failing after h17b01 when 6798898 introduced this assert.
Indentical behaviour with hs16-latest as well.

If i suppress the assert, then the program runs happily, even passes
heap verification.
Run specjvm98 with -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses using a debug jvm.
It'll fail the following assertion:-

VM option '+PrintGCDetails'
VM option '+UseConcMarkSweepGC'
VM option '+ExplicitGCInvokesConcurrentAndUnloadsClasses'
VM option '+ShowMessageBoxOnError'
Speed will be 100
Will run each benchmark at most 5 times
Will run each benchmark at least 5 times
Will gc in between benchmarks
Will delay 3000 ms in between benchmarks
[GC [ParNew: 532K->141K(14784K), 0.0249376 secs] 532K->141K(63936K), 0.0259883 secs] [Times: user=0.05 sys=0.00, real=0.03 secs] 
[GC [1 CMS-initial-mark: 0K(49152K)] 141K(63936K), 0.0177653 secs] [Times: user=0.02 sys=0.00, real=0.02 secs] 
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/cmsOopClosures.inline.hpp:43
==============================================================================
Unexpected Error
------------------------------------------------------------------------------
Internal Error at cmsOopClosures.inline.hpp:43, pid=7193, tid=5 
Error: assert(_should_remember_klasses == must_remember_klasses(),"Should remember klasses in this context.")

Do you want to debug the problem?

To debug, run 'dbx - 7193'; then switch to thread 5
Enter 'yes' to launch dbx automatically (PATH must include dbx)
Otherwise, press RETURN to abort...
==============================================================================

=>[1] _waitid(0x0, 0x1c1e, 0xf1f7f0e0, 0x3, 0xff2eecc8, 0x4), at 0xff2c1dd0 
  [2] _waitpid(0x1c1e, 0xf1f7f244, 0x0, 0x1c1e, 0xfa6e0800, 0x0), at 0xff26852c 
  [3] waitpid(0x1c1e, 0xf1f7f244, 0x0, 0x0, 0xfa6e0800, 0xff2eec80), at 0xff2b4bfc 
  [4] os::fork_and_exec(0xfefc9730, 0xfefc9730, 0xfeb9d263, 0x9a400, 0xffc7eb5e, 0xfeb9d266), at 0xfdcd8f1c 
  [5] VMError::report_and_die(0xf1f7f3a4, 0x5a800, 0x5, 0x9b800, 0xfef9f66c, 0xab000), at 0xfe094dd8 
  [6] report_assertion_failure(0xfe5938ac, 0x2b, 0xfe593915, 0x5aa87, 0xfef1e708, 0x5a800), at 0xfd341918 
  [7] KlassRememberingOopClosure::should_remember_klasses(0xf1f7f630, 0xfef79400, 0x1, 0xfe593800, 0xfe593800, 0x0), at 0xfd302c2c 
  [8] klassKlass::oop_oop_iterate(0x1e, 0xf1f7f514, 0xf1f7f630, 0x0, 0xfd42a30c, 0xfd2f51b8), at 0xfda6a730 
  [9] Klass::oop_oop_iterate_nv(0xf6400008, 0xf1f7f620, 0xfda6a328, 0xfef8fccc, 0x0, 0xf6400000), at 0xfcef8be4 
  [10] MarkFromRootsClosure::scanOopsInOop(0xf1f7f7f8, 0xf6400000, 0xf1f7f620, 0xf1f7f66c, 0xfef79638, 0xf1f7f630), at 0xfd2f2370 
  [11] MarkFromRootsClosure::do_bit(0xf1f7f7f8, 0x7000000, 0x1c00000, 0xfe5b4a13, 0xf6400000, 0x40000001), at 0xfd2f1340 
  [12] BitMap::iterate(0xa5318, 0xf1f7f7f8, 0xc00000, 0x1c00000, 0x60000, 0xfef1e708), at 0xfcf69d5c 
  [13] CMSCollector::do_marking_st(0xa51f0, 0xfef9e000, 0xfa6, 0xfef9e104, 0x7d3704, 0x7d38a2), at 0xfd2de51c 
  [14] CMSCollector::markFromRoots(0xa51f0, 0x1, 0xfef3fecc, 0xfe5a0ca8, 0xfef3fc00, 0x1), at 0xfd2d93a0 
  [15] CMSCollector::collect_in_background(0xa51f0, 0xfef9e104, 0xa5628, 0x44020, 0xfef68800, 0x1), at 0xfd2d3a54 
  [16] ConcurrentMarkSweepThread::run(0xc5c00, 0x0, 0x44020, 0x7d0, 0xfef9a000, 0xfef79400), at 0xfd3034a4 
  [17] java_start(0xc5c00, 0x80379, 0xfef1e708, 0xa8c00, 0x4, 0x0), at 0xfdcc89f0

                                    

Comments
EVALUATION

The problem was in the RememberClassesChecker usage.  I had overlooked the flag
ExplicitGCInvokesConcurrentAndUnloadsClasses as a reason for class unloading so
there was an inconsistency in the use of RememberClassesChecker.
                                     
2009-11-04
SUGGESTED FIX

Replace CMSClassUnloadingEnabled in the constructor for RememberKlassesChecker with
should_unload_classes().
                                     
2009-11-05
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/4788266644c1
                                     
2010-01-21
EVALUATION

ChangeSet=http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/4788266644c1,ChangeRequest=6895236
                                     
2010-01-28



Hardware and Software, Engineered to Work Together