8370198: Test gc/arguments/TestShrinkHeapInSteps.java crashed: assert(left >= right) failed: avoid underflow#28393
Conversation
|
👋 Welcome back ayang! A progress list of the required criteria for merging this PR into |
|
@albertnetymk 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: 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 21 new commits pushed to the
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 |
|
@albertnetymk The following label will be automatically applied to this pull request:
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. |
Webrevs
|
stefank
left a comment
There was a problem hiding this comment.
This is quite conspicuous. Could this the addition be added to a function (or macro) so that the check becomes a one-liner. We have a similar function inside the ZGC runtime barriers. See:
template <typename ZBarrierSlowPath>
inline zaddress ZBarrier::barrier(ZBarrierFastPath fast_path, ZBarrierSlowPath slow_path, ZBarrierColor color, volatile zpointer* p, zpointer o, bool allow_null) {
z_verify_safepoints_are_blocked();
... < rest of the function >
I don't understand why we would want to put this check between the two range changes. Is there a reason why the added check couldn't be done at the beginning of the function?
I can't come up with a good name to abstract its semantics -- its correct invocation requires quite specific calling context, so I think it's best to "inline" it to the caller.
The thing is that |
That doesn't instill confidence. I think we might have to figure out what semantics we want the check to have. Maybe it can be fixed by the suggestion below:
This also means that this calling code can only use the negative version of that check: A check like: would trigger the introduced assert that we are calling this from I suggest that we remove this assert. It was needed when we had PermGen, but now we have other safeguards. Just a few lines below we have |
|
There are three related but distinct parts in this problem/solution:
AnalysisTo resolve the specific crash observed once in JDK-8370198, removing the unnecessary assertion in Additionally, there may be other problematic uses of this API that became unsafe after the recent heap/young-generation resizing support. Part (3) aims to uncover such issues. |
|
After some offline discussion with Stefan, it's suggested that After removing the asserts in |
|
@albertnetymk |
stefank
left a comment
There was a problem hiding this comment.
Please extract the verification into a helper function / macro
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
|
Thanks for review. /integrate |
|
Going to push as commit d34ef19.
Your commit was automatically rebased without conflicts. |
|
@albertnetymk Pushed as commit d34ef19. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
|
/backport :jdk26 |
|
@albertnetymk the backport was successfully created on the branch backport-albertnetymk-d34ef196-jdk26 in my personal fork of openjdk/jdk. To create a pull request with this backport targeting openjdk/jdk:jdk26, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk: |
Add an early-return for outside-heap address in
CollectedHeap::is_inAPI.While investigating this failure (JDK-8370198), I realized that some java-threads (compiler-threads) in
nativestate can invokeCollectedHeapAPIs. Since heap-resizing occurs inside safepoint but java-threads innativestate just ignore safepoint, I have added some assert to catch such dangerous uses, where the return value might not be stable.Test: tie1-5; can't reproduce the JDK-8370198 with or without this patch for >8000 runs.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28393/head:pull/28393$ git checkout pull/28393Update a local copy of the PR:
$ git checkout pull/28393$ git pull https://git.openjdk.org/jdk.git pull/28393/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28393View PR using the GUI difftool:
$ git pr show -t 28393Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28393.diff
Using Webrev
Link to Webrev Comment