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

JDK-8242032 uses wrong contains_reference() in assertion code

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc
    • Resolved In Build:
      b11
    • Verification:
      Verified

      Description

      JDK-8242032 added the following code under lock:

          // Rechecking if the region is coarsened, while holding the lock.
          if (is_region_coarsened(from_hrm_ind)) {
            assert(contains_reference(from), "We just found " PTR_FORMAT " in the Coarse table", p2i(from));
            return;
          }

      The problem is the contains_reference() call, that tries to lock the same Mutex while already holding that same lock. Actually the comment above that "if" says that we're holding the lock....

      So Mutex code correctly asserts with

        assert(owner() != self) failed: invariant

      The fix is to call contains_reference_locked() instead.

      The original author of JDK-8242032 already mentioned that he could not reproduce the situation - now we have evidence that there is such a problem. :)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tschatzl Thomas Schatzl
              Reporter:
              tschatzl Thomas Schatzl
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: