Skip to content

Conversation

@tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Mar 14, 2025

Hi all,

please review this fix for a crash in G1 where it tries to reclaim a pinned region that does not have any reference visible to the VM any more and there are no other reachable pinnable objects in the same region. This can happen e.g. when JNI code is the only holder for a reference.

This has been reported this in a real application, but the attached test case (that uses WhiteBox to simulate a lone pinnable object in a region where the GC does not have a reference any more) shows the principle as well.

The solution involves unconditionally adding pinned regions in the collection set to the set of evacuation failed regions, instead of only doing that when G1 first encounters a reachable pinnable object in that pinned region.

Testing: gha, tier1-5

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-8351921: G1: Pinned regions with pinned objects only reachable by native code crash VM (Bug - P2)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24060

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 14, 2025

👋 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
Copy link

openjdk bot commented Mar 14, 2025

@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:

8351921: G1: Pinned regions with pinned objects only reachable by native code crash VM

Reviewed-by: ayang, iwalulya

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 24 new commits pushed to the master branch:

  • 19154f7: 8351970: Retire JavaLangAccess::exit
  • 3aa6d62: 8351372: Improve negative tests coverage of jpackage
  • 3239919: 8350835: C2 SuperWord: assert/wrong result when using Float.float16ToFloat with byte instead of short input
  • 47c1960: 8351689: -Xshare:dump with default classlist fails on static JDK
  • 6b82b42: 8348598: Update Libpng to 1.6.47
  • 2674a31: 8351891: Disable TestBreakSignalThreadDump.java#with_jsig and XCheckJSig.java on static JDK
  • 4c6a523: 8352096: Test jdk/jfr/event/profiling/TestFullStackTrace.java shouldn't be executed with -XX:+DeoptimizeALot
  • d68775d: 8351995: JFR: Leftovers from removal of Security Manager
  • e62becc: 8350964: Add an ArtifactResolver.fetch(clazz) method
  • dbf47d6: 8351876: RISC-V: enable and fix some float round tests
  • ... and 14 more: https://git.openjdk.org/jdk/compare/86b24339dc05422f61e10023f97a9013e2c03a15...master

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 changed the title 8351921 8351921: G1: Pinned regions with pinned objects only reachable by native code crash VM Mar 14, 2025
@openjdk
Copy link

openjdk bot commented Mar 14, 2025

@tschatzl The following label will be automatically applied to this pull request:

  • hotspot-gc

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Mar 14, 2025
@tschatzl tschatzl marked this pull request as ready for review March 17, 2025 15:43
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 17, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 17, 2025

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.

Looks good!

Nits:

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed ready Pull request is ready to be integrated labels Mar 17, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 17, 2025
@tschatzl
Copy link
Contributor Author

Thanks @albertnetymk @walulyai for your reviews

/integrate

@openjdk
Copy link

openjdk bot commented Mar 18, 2025

Going to push as commit 558c015.
Since your change was applied there have been 28 commits pushed to the master branch:

  • f8c2122: 8352138: G1: Remove G1AddMetaspaceDependency.java test
  • e1bcff3: 8345687: Improve the implementation of SegmentFactories::allocateSegment
  • f4ddac5: 8331201: UBSAN enabled build reports on Linux x86_64 runtime error: shift exponent 65 is too large for 64-bit type 'long unsigned int'
  • 38499b3: 8352084: Add more test code in TestSetupAOT.java
  • 19154f7: 8351970: Retire JavaLangAccess::exit
  • 3aa6d62: 8351372: Improve negative tests coverage of jpackage
  • 3239919: 8350835: C2 SuperWord: assert/wrong result when using Float.float16ToFloat with byte instead of short input
  • 47c1960: 8351689: -Xshare:dump with default classlist fails on static JDK
  • 6b82b42: 8348598: Update Libpng to 1.6.47
  • 2674a31: 8351891: Disable TestBreakSignalThreadDump.java#with_jsig and XCheckJSig.java on static JDK
  • ... and 18 more: https://git.openjdk.org/jdk/compare/86b24339dc05422f61e10023f97a9013e2c03a15...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 18, 2025

@tschatzl Pushed as commit 558c015.

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

@tschatzl tschatzl deleted the submit/8351921-pinned-regions-crash branch April 24, 2025 08:36
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