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

StringTable: assert(number_of_entries_counted==number_of_entries_expected) failed: should be equal

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 9
    • 8
    • hotspot
    • None
    • Mac OS X

      StringTable: assert(number_of_entries_counted==number_of_entries_expected) failed: should be equal

      While working on JDK-6610955 I noticed an assert triggering in my code, but the assert itself (added to StringTable::verify()) still triggers even with clean JDK8 repo. This results in the following hotspot/test failures:


      Execution failed: `main' threw exception: java.lang.RuntimeException: Expected to get exit value of [0]

      gc/g1/TestDeferredRSUpdate.java: Ensure that running with -XX:-G1DeferredRSUpdate does not crash the VM
      gc/g1/TestGCLogMessages.java: Ensure that the PrintGCDetails output for a minor GC with G1 includes the expected necessary messages.


      Here is the spewage from TestDeferredRSUpdate test:


      >>>>>> OH, oh
      >>>>>> number_of_entries_counted: 758
      >>>>>> number_of_entries_expected: 759


      # To suppress the following error report, specify this argument
      # after -XX: or in .hotspotrc: SuppressErrorAt=/symbolTable.cpp:939
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/Users/gerard/Desktop/jdk8_before/hotspot/src/share/vm/classfile/symbolTable.cpp:939), pid=75670, tid=19715
      # assert(number_of_entries_counted==number_of_entries_expected) failed: should be equal
      #
      # JRE version: Java(TM) SE Runtime Environment (8.0) (build 1.8.0-internal-fastdebug-gerard_2014_09_09_22_07-b00)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (1.8-b0-internal-fastdebug mixed mode bsd-amd64 compressed oops)
      # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
      #
      # An error report file with more information is saved as:
      # /Users/gerard/Desktop/jdk8_after_2/hotspot/JTwork/scratch/hs_err_pid75670.log
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.sun.com/bugreport/crash.jsp
      #


      Here is the modified StringTable::verify() in symbolTable.cpp file (in JDK9 the tables are split into separate files):

      // This verification is part of Universe::verify() and needs to be quick.
      // See StringTable::verify_and_compare() below for exhaustive verification.
      void StringTable::verify() {
        int number_of_entries_counted = 0;
        for (int i = 0; i < the_table()->table_size(); ++i) {
          HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
          for ( ; p != NULL; p = p->next()) {
            oop s = p->literal();
            guarantee(s != NULL, "interned string is NULL");
            unsigned int h = java_lang_String::hash_string(s);
            guarantee(p->hash() == h, "broken hash in string table entry");
            guarantee(the_table()->hash_to_index(h) == i,
                      "wrong index in string table");
            number_of_entries_counted++;
          }
        }
      #ifdef ASSERT
        int number_of_entries_expected = the_table()->number_of_entries();
        if (number_of_entries_counted!=number_of_entries_expected) {
          tty->print("\n");
          tty->print("\n");
          tty->print(">>>>>> OH, oh\n");
          tty->print(">>>>>> number_of_entries_counted: %d\n", number_of_entries_counted);
          tty->print(">>>>>> number_of_entries_expected: %d\n", number_of_entries_expected);
          tty->print("\n");
          tty->print("\n");
        }
        assert(number_of_entries_counted==number_of_entries_expected, "should be equal");
      #endif // ASSERT
      }

      The way to run the test on Mac from within /Users/gerard/Desktop/jdk8/hotspot:

      /Volumes/work/tests/jtreg/bin/jtreg -testjdk /tmp/jdk_build/jdk test/gc/g1 ; say "done testing"

            gziemski Gerard Ziemski
            gziemski Gerard Ziemski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: