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

8316632: Shenandoah: Raise OOME when gc threshold is exceeded #15852

Closed

Conversation

earthling-amzn
Copy link
Contributor

@earthling-amzn earthling-amzn commented Sep 20, 2023

Shenandoah will run back-to-back full GCs and almost grind mutator progress to a halt before eventually exhausting memory. This change will have Shenandoah raise a gc threshold exceeded exception if the collector fails to make progress after ShenandoahNoProgressThreshold full GC cycles (default is 3).


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-8316632: Shenandoah: Raise OOME when gc threshold is exceeded (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15852

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 20, 2023

👋 Welcome back wkemper! 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 added the rfr Pull request is ready for review label Sep 20, 2023
@openjdk
Copy link

openjdk bot commented Sep 20, 2023

@earthling-amzn The following labels will be automatically applied to this pull request:

  • hotspot-gc
  • shenandoah

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

@openjdk openjdk bot added hotspot-gc hotspot-gc-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Sep 20, 2023
@mlbridge
Copy link

mlbridge bot commented Sep 20, 2023

Copy link
Contributor

@kdnilsen kdnilsen 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 to me.

@shipilev
Copy link
Member

Please also run tier1 tier2 tier3 with Shenandoah? In hotspot:tier1, I am seeing the failure here:

TEST: gc/InfiniteList.java

STDERR:
Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
        at java.base/java.util.jar.Manifest$FastInputStream.<init>(Manifest.java:421)
        at java.base/java.util.jar.Manifest$FastInputStream.<init>(Manifest.java:416)
        at java.base/java.util.jar.Manifest.read(Manifest.java:287)
        at java.base/java.util.jar.Manifest.<init>(Manifest.java:101)
        at java.base/java.util.jar.Manifest.<init>(Manifest.java:88)
        at java.base/java.util.jar.JarFile.getManifestFromReference(JarFile.java:431)
        at java.base/java.util.jar.JarFile.getManifest(JarFile.java:405)
        at java.base/jdk.internal.loader.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:853)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:848)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        at com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:94)

@earthling-amzn
Copy link
Contributor Author

I will run additional tests with Shenandoah enabled.

Copy link
Member

@ysramakrishna ysramakrishna left a comment

Choose a reason for hiding this comment

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

I have a few questions; thanks for clearing up my confusion! :-)

src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Outdated Show resolved Hide resolved
Copy link
Member

@ysramakrishna ysramakrishna left a comment

Choose a reason for hiding this comment

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

LGTM, modulo a couple of clarifying documentation comments, as discussed.

@openjdk
Copy link

openjdk bot commented Sep 23, 2023

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

8316632: Shenandoah: Raise OOME when gc threshold is exceeded

Reviewed-by: kdnilsen, ysr, shade

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

  • 9123961: 8318096: Introduce AsymmetricKey interface with a getParams method
  • 4a142c3: 8274122: java/io/File/createTempFile/SpecialTempFile.java fails in Windows 11
  • 77fe0fd: 8272215: Add InetAddress methods for parsing IP address literals

Please see this link for an up-to-date comparison between the source branch of this pull request and 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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@ysramakrishna, @shipilev) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 23, 2023
Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Apologies, but I have more comments.

test/hotspot/jtreg/TEST.groups Outdated Show resolved Hide resolved
@@ -873,19 +874,33 @@ HeapWord* ShenandoahHeap::allocate_memory(ShenandoahAllocRequest& req) {
result = allocate_memory_under_lock(req, in_new_region);
}

if (result == nullptr && !req.is_lab_alloc() && get_gc_no_progress_count() > ShenandoahNoProgressThreshold) {
Copy link
Member

Choose a reason for hiding this comment

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

Can this be moved to the block that already does allocation-after-gc retries? That block already exits with nullptr (implies delivering OOME), and it already calls handle_alloc_failure (thus triggering GC). We "only" need it to specialize for is_lab_alloc and ShenandoahNoProgressThreshold?

This PR changes that block anyway...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I've made this change as you suggest, but I'm not sure it improves readability. Note that when the ShenandoahNoProgressThreshold is exceeded, we do not retry the allocation or wait for another gc cycle to complete.

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Outdated Show resolved Hide resolved
@@ -271,7 +271,7 @@ public static class TargetVMOptions {
public final boolean EliminateAllocations;
public final boolean DeoptimizeObjectsALot;
public final boolean DoEscapeAnalysis;
public final boolean ZGCIsSelected;
public final boolean ConcurrentGCIsSelected;
Copy link
Member

Choose a reason for hiding this comment

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

Let's do explicit ZGCIsSelected and ShenandoahIsSelected. Unfortunately, "Concurrent GC" is fairly ambiguous.

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Outdated Show resolved Hide resolved
Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

All right, this looks fine.

@earthling-amzn
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Oct 26, 2023
@openjdk
Copy link

openjdk bot commented Oct 26, 2023

@earthling-amzn
Your change (at version 95f3379) is now ready to be sponsored by a Committer.

@shipilev
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Oct 27, 2023

Going to push as commit 5b5fd36.
Since your change was applied there have been 4 commits pushed to the master branch:

  • abad040: 8313781: Add regression tests for large page logging and user-facing error messages
  • 9123961: 8318096: Introduce AsymmetricKey interface with a getParams method
  • 4a142c3: 8274122: java/io/File/createTempFile/SpecialTempFile.java fails in Windows 11
  • 77fe0fd: 8272215: Add InetAddress methods for parsing IP address literals

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 27, 2023

@shipilev @earthling-amzn Pushed as commit 5b5fd36.

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

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 shenandoah shenandoah-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

4 participants