Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7066603

Heap dump omits objects when CMS collector in use

XMLWordPrintable

    • gc
    • generic, x86
    • generic, linux

      FULL PRODUCT VERSION :
      java version "1.6.0_26"
      Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
      Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)

      FULL OS VERSION :
      Linux lightning 2.6.18-194.8.1.el5 #1 SMP Wed Jun 23 10:58:38 EDT 2010 i686 i686 i386 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      When Java is started with -XX:+UseConcMarkSweepGC (i.e., the CMS collector is used), heap dumps obtained with jmap omit many objects: jhat reports many errors like "WARNING: Failed to resolve object id 0xafef83e8 for field TYPE (signature L)" and Eclipse MAT also fails some queries over the heap dump.

      This does not happen when using the default collector, only when using CMS.

      It worked fine in 1.6.0_07, and has definitely been broken since at least 1.6.0_20 (possibly earlier).

      We have a latency-senstive application, so have to use the CMS low-pause collector.

      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

      REGRESSION. Last worked in version 6

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create Test.java according to the attachment below, and compile it:

      javac Test.java

      Now in one window run it:

      java -XX:+UseConcMarkSweepGC Test

      (if you omit -XX:+UseConcMarkSweepGC, the error does not appear).

      and then in another window (while it is still running) take a dump as follows:

      rm -f heaptest.bin; jmap -dump:format=b,file=heaptest.bin `pgrep -f Test`

      Now do

      jhat heaptest.bin

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected behaviour:

      Reading from heaptest.bin...
      Dump file created Wed Jul 13 17:31:08 BST 2011
      Snapshot read, resolving...
      Resolving 5313 objects...
      Chasing references, expect 1 dots.
      Eliminating duplicate references.
      Snapshot resolved.
      Started HTTP server on port 7000
      Server is ready.

      Actual behaviour:

      Reading from heaptest.bin...
      Dump file created Wed Jul 13 17:31:32 BST 2011
      Snapshot read, resolving...
      Resolving 2825 objects...
      WARNING: Failed to resolve object id 0xaff68508 for field TYPE (signature L)
      WARNING: Failed to resolve object id 0xb0067518 for field CHECK_VALUES_DIR (signature L)
      WARNING: Failed to resolve object id 0xb00674c8 for field CHECK_VALUES_FILE (signature L)
      WARNING: Failed to resolve object id 0xb0065a48 for field INSTALL_PROPERTY (signature L)
      WARNING: Failed to resolve object id 0xb0065a08 for field DEPENDENCIES_PROPERTY (signature L)
      WARNING: Failed to resolve object id 0xb00659d8 for field SIZE_PROPERTY (signature L)
      WARNING: Failed to resolve object id 0xb00659a0 for field JAR_PATH_PROPERTY (signature L)
      WARNING: Failed to resolve object id 0xb0065968 for field KERNEL_PATH_SUFFIX (signature L)
      WARNING: Failed to resolve object id 0xb0065938 for field CUSTOM_PREFIX (signature L)
      WARNING: Failed to resolve object id 0xb004adc8 for field JAVA_VERSION (signature L)
      WARNING: Failed to resolve object id 0xb0067fb8 for field MUTEX_PREFIX (signature L)
      WARNING: Failed to resolve object id 0xb00658f0 for field RESOURCE_URL (signature L)
      WARNING: Failed to resolve object id 0xb0065890 for field KERNEL_SIMULTANEOUS_DOWNLOADS_PROPERTY (signature L)
      WARNING: Failed to resolve object id 0xb0065850 for field KERNEL_NOMERGE_PROPERTY (signature L)
      WARNING: Failed to resolve object id 0xb0065810 for field KERNEL_DEBUG_PROPERTY (signature L)
      WARNING: Failed to resolve object id 0xb00657c0 for field KERNEL_DOWNLOAD_DIALOG_PROPERTY (signature L)
      WARNING: Failed to resolve object id 0xb0065768 for field KERNEL_DOWNLOAD_ENABLED_PROPERTY (signature L)
      [...many lines omitted...]
      WARNING: Failed to resolve object id 0xb00a8c48 for field theProp (signature L)
      WARNING: Failed to resolve object id 0xb0034210 for field replacement (signature L)
      WARNING: Failed to resolve object id 0xaff68568 for field type (signature L)
      WARNING: Failed to resolve object id 0xb00d0698 for field name (signature L)
      Chasing references, expect 0 dots
      Eliminating duplicate references
      Snapshot resolved.
      Started HTTP server on port 7000
      Server is ready.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      See above.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Test {
      public static final String sFoo = "Foo!";
      public static void main(String[] args) throws Exception {
      while (true) {
      System.out.println(sFoo);
      Thread.sleep(1000);
      }
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Omit -XX:+UseConcMarkSweepGC. This is no good if you depend on the CMS collector, e.g., because of GC tuning or because you need a low-pause collector.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: