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

JFR RootResolver resets CLD claims with no restore

    Details

    • Subcomponent:
      jfr
    • Resolved In Build:
      b28
    • Verification:
      Not verified

      Backports

        Description

        rootResolver.cpp:

        void RootResolver::resolve(RootCallback& callback) {

          // Need to clear cld claim bit before starting
          ClassLoaderDataGraph::clear_claimed_marks(); <<-- !
          RootResolverMarkScope mark_scope;

          // thread local roots
          ReferenceToThreadRootClosure rtrc(callback);
          if (rtrc.complete()) {
            return;
          }
          // system global roots
          ReferenceToRootClosure rrc(callback);
        }

        The code above is correct under the premise that the saveRestore construct for restoring CLD claims is on the stack. And I think it was originally. I can't remember how but it was moved to RootSetClosure::process_roots(). This means the above code in RootResolver is invalid.

          // Iteration over CLDs involves setting a claim bit.
          // Save the currently claimed CLDs and restore their claimed state upon completion (function exit).
          SaveRestoreCLDClaimBits save_restore_cld_claim_bits;

        We need to move SaveRestoreCLDClaimBits, from inside RootSetClosure::process_roots() back up to EmitEventOperation::doit() for the proper scope.

        The problematic path triggers only if the option "path-to-gc-roots=true" is set via the command-line or via jcmd AND an existing leak candidate is found.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mgronlun Markus Grönlund
                  Reporter:
                  mgronlun Markus Grönlund
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: