JVM is crashing in the CMS collector after moving to Java 7

Solution Verified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 5.2.0
    • 6.x
  • Sun JDK 1.7, update 21 with the CMS collector enabled

Issue

  • After moving to Java 7, our JVM frequently crashes in CMS operations:
Stack: [0x00000000,0x00000000],  sp=0xfb77f4c0,  free space=4120061k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x95f214]  void ParRootScanWithBarrierTwoGensClosure::do_oop(oopDesc**)+0xc0
V  [libjvm.so+0x92e554]  int objArrayKlass::oop_oop_iterate_nv_m(oopDesc*,FilteringClosure*,MemRegion)+0xb8
V  [libjvm.so+0x4f3dd4]  void FreeListSpace_DCTOC::walk_mem_region_with_cl_par(MemRegion,HeapWord*,HeapWord*,FilteringClosure*)+0x384
V  [libjvm.so+0x4f3a48]  void FreeListSpace_DCTOC::walk_mem_region_with_cl(MemRegion,HeapWord*,HeapWord*,FilteringClosure*)+0x74
V  [libjvm.so+0x9e9e34]  void Filtering_DCTOC::walk_mem_region(MemRegion,HeapWord*,HeapWord*)+0x64
V  [libjvm.so+0x9e9c14]  void DirtyCardToOopClosure::do_MemRegion(MemRegion)+0xfc
V  [libjvm.so+0x4785f4]  void ClearNoncleanCardWrapper::do_MemRegion(MemRegion)+0x194
V  [libjvm.so+0x95aa30]  void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space*,MemRegion,OopsInGenClosure*,CardTableRS*,int)+0x390
V  [libjvm.so+0x4774fc]  void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space*,MemRegion,OopsInGenClosure*,CardTableRS*)+0x50
V  [libjvm.so+0x4786b8]  void CardTableRS::younger_refs_in_space_iterate(Space*,OopsInGenClosure*)+0x38
V  [libjvm.so+0x529da0]  void ConcurrentMarkSweepGeneration::younger_refs_iterate(OopsInGenClosure*)+0x40
V  [libjvm.so+0x5f5f3c]  void GenCollectedHeap::gen_process_strong_roots(int,bool,bool,bool,SharedHeap::ScanningOption,OopsInGenClosure*,bool,OopsInGenClosure*)+0x194
V  [libjvm.so+0x95fe00]  void ParNewGenTask::work(unsigned)+0x13c
V  [libjvm.so+0xac9c38]  void GangWorker::loop()+0xa4
V  [libjvm.so+0x9438c0]  java_start+0x338

Resolution

  • To address this issue, you should consider:
    • Upgrading to the latest JDK update to consume any relevant fixes

    • Engaging Oracle support for further assistance with a fix to this JDK CMS collector issue

    • Using a different collector to avoid this CMS issue. With Java 7, a new G1 collector was released that is designed as the successor and eventual replacement for CMS so you could consider trying this collector instead. This Content from www.oracle.com is not included.Oracle tech brief provides an overview of this collector. You can enable the G1 collector with the following JVM option:

        –XX:+UseG1GC
      

Root Cause

  • A bug in the CMS collector

Diagnostic Steps

See Java Crash in GCTaskThread.

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.