Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8320331: G1 Full GC Heap verification relies on metadata not reset before verification #16733

Conversation

tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Nov 20, 2023

Hi all,

please review this fix to full gc to properly set parsable_bottom for the heap regions marked through so that "during" verification (-XX:+VerifyDuringGC) does not access metadata already unlinked but not yet completely purged.

The test case reproduces crashes fairly well without the patch; the new test case is run with debug VMs only purely to save testing time.

Testing: gha, test case

Thanks,
Thomas


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8320331: G1 Full GC Heap verification relies on metadata not reset before verification (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16733/head:pull/16733
$ git checkout pull/16733

Update a local copy of the PR:
$ git checkout pull/16733
$ git pull https://git.openjdk.org/jdk.git pull/16733/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16733

View PR using the GUI difftool:
$ git pr show -t 16733

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16733.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 20, 2023

👋 Welcome back tschatzl! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot changed the title 8320331 8320331: G1 Full GC Heap verification relies on metadata not reset before verification Nov 20, 2023
@tschatzl
Copy link
Contributor Author

/label add hotspot-gc

@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Nov 20, 2023
@openjdk
Copy link

openjdk bot commented Nov 20, 2023

@tschatzl
The hotspot-gc label was successfully added.

@tschatzl tschatzl marked this pull request as ready for review November 20, 2023 11:26
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 20, 2023
@mlbridge
Copy link

mlbridge bot commented Nov 20, 2023

Webrevs

Copy link
Member

@walulyai walulyai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Minor:

  • update the comment associated with _parsable_bottom
  • Add a comment to prepare_for_full_gc to hint on why this is required.

@openjdk
Copy link

openjdk bot commented Nov 22, 2023

@tschatzl This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8320331: G1 Full GC Heap verification relies on metadata not reset before verification

Reviewed-by: iwalulya, ayang

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 44 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 22, 2023
@@ -167,6 +167,13 @@ inline size_t HeapRegion::block_size(const HeapWord* p, HeapWord* const pb) cons
return cast_to_oop(p)->size();
}

inline void HeapRegion::prepare_for_full_gc() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this API should be part of this class. It appears entirely caller-specific, and it's unclear why the implementation is just a field-update without knowledge of the caller context. While the comment helps mitigate the situation, making it acceptable for a bugfix, I think it would be more appropriate to relocate methods related to parsable-bottom outside of this class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this API should be part of this class. It appears entirely caller-specific,

All of these _for_full_gc/_after_full_gc methods (and note_*_marking/scrubbing methods for concurrent mark) are caller specific, for exactly one caller, for a particular situation the caller encounters. Is there something particularly problematic with this exact method compared to others?

and it's unclear why the implementation is just a field-update without knowledge of the caller context. While the comment helps mitigate the situation, making it acceptable for a bugfix, I think it would be more appropriate to relocate methods related to parsable-bottom outside of this class.

So basically _parsable_bottom (and _top_at_mark_start since it is very similar to PB) fields should be somewhere else then? I think there is a CR for moving TAMS somewhere else, there is nothing for PB.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something particularly problematic with this exact method compared to others?

No; all of them require caller-info to understand the impl.

fields should be somewhere else then?

Yes, because they are constructed/maintained by sth external to heap-region, IMO.

@tschatzl
Copy link
Contributor Author

Thanks @albertnetymk @walulyai for your reviews
/integrate

@openjdk
Copy link

openjdk bot commented Nov 22, 2023

Going to push as commit 1629a90.
Since your change was applied there have been 54 commits pushed to the master branch:

  • 93bdc2a: 8306055: Add a built-in Catalog to JDK XML module
  • a4bd9e4: 8319440: RISC-V: jdk can't be built with clang due to register keyword
  • 524da14: 8320418: PPC64: invokevfinal_helper duplicates code to handle ResolvedMethodEntry
  • 5d4a54b: 8319449: compiler/print/CompileCommandPrintMemStat.java fails on Graal
  • 35526d0: 8257076: os::scan_pages is empty on all platforms
  • 25cebe8: 8317799: AIX PPC64: FFI symbol lookup doesn't find symbols
  • c39d001: 8319137: release _object in ObjectMonitor dtor to avoid races
  • 8b47a14: 8320309: AIX: pthreads created by foreign test library don't work as expected
  • bf0a904: 8318175: AIX PPC64: Handle alignment of double in structs
  • 6ce0ebb: 8295343: sun/security/pkcs11 tests fail on Linux RHEL 8.6 and newer
  • ... and 44 more: https://git.openjdk.org/jdk/compare/6c5e15c1a291ca5ba1e4c3a90351bc71665ce988...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 22, 2023
@openjdk openjdk bot closed this Nov 22, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 22, 2023
@openjdk
Copy link

openjdk bot commented Nov 22, 2023

@tschatzl Pushed as commit 1629a90.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@tschatzl tschatzl deleted the submit/8320331-full-gc-heap-verification branch January 16, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants