JDK-8262197 : JDK-8242032 uses wrong contains_reference() in assertion code
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 17
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2021-02-23
  • Updated: 2024-05-02
  • Resolved: 2021-02-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b11Fixed
Related Reports
Relates :  
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. :)
Comments
Changeset: 67762de6 Author: Thomas Schatzl <tschatzl@openjdk.org> Date: 2021-02-23 15:55:07 +0000 URL: https://git.openjdk.java.net/jdk/commit/67762de6
23-02-2021