Skip to content

8306992: [JVMCI] mitigate more against JVMCI related OOME causing VM to exit#13905

Closed
dougxc wants to merge 5 commits intoopenjdk:masterfrom
dougxc:JDK-8306992
Closed

8306992: [JVMCI] mitigate more against JVMCI related OOME causing VM to exit#13905
dougxc wants to merge 5 commits intoopenjdk:masterfrom
dougxc:JDK-8306992

Conversation

@dougxc
Copy link
Member

@dougxc dougxc commented May 10, 2023

This PR makes the following changes to mitigate against an OOME or other recoverable error in JVMCI from causing the VM to exit:

  • Tracks upcalls into libjvmci or creation of libjvmci.
  • If 10% or more of these calls fail with an uncaught exception, then JVMCI compilation is disabled (i.e. future compilations fall back to Tier 1).

When JVMCI compilation is disabled, a warning is emitted:

[0.064s][warning][jit,compilation] JVMCI compiler disabled after 11 of 15 upcalls had errors (Last error: "uncaught exception in call_HotSpotJVMCIRuntime_compileMethod"). Use -Xlog:jit+compilation for more detail.

With -Xlog:jit+compilation, the extra detail shown is:

[0.182s][info][jit,compilation] uncaught exception in call_HotSpotJVMCIRuntime_compileMethod while compiling java.util.stream.StreamOpFlag.fromCharacteristics(Ljava/util/Spliterator;)I
Exception in thread "JVMCI-native CompilerThread0": java.lang.InternalError
java.lang.InternalError: aborting compilation of HotSpotMethod<Object.<init>()>
	at jdk.internal.vm.ci@20.0.2-internal/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:923)

Note that the errors treated by the changes in the PR are expected to be exceedingly rare. For example, an OOME while starting a libgraal isolate or initializing the JVMCI compiler. Exceptions thrown during compilation are already handled by the Graal CompilationWrapper.


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-8306992: [JVMCI] mitigate more against JVMCI related OOME causing VM to exit

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13905

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 10, 2023

👋 Welcome back dnsimon! 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 May 10, 2023

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

  • hotspot-compiler

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-compiler hotspot-compiler-dev@openjdk.org label May 10, 2023
ResourceMark rm(thread);
JavaThreadState state = JavaThread::cast(thread)->thread_state();
if (state == _thread_in_vm || state == _thread_in_Java || state == _thread_new) {
tty->print("JVMCITrace-%d[%s]:%*c", level, thread->name(), level, ' ');
Copy link
Member Author

Choose a reason for hiding this comment

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

This change helps correlate threads in a trace that transition in and out of libgraal (thread name is not available when in libgraal).

@dougxc dougxc marked this pull request as ready for review May 10, 2023 14:26
@openjdk openjdk bot added the rfr Pull request is ready for review label May 10, 2023
@mlbridge
Copy link

mlbridge bot commented May 10, 2023

Webrevs

@openjdk
Copy link

openjdk bot commented May 17, 2023

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

8306992: [JVMCI] mitigate more against JVMCI related OOME causing VM to exit

Reviewed-by: never

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

  • b58980b: 8308034: Some CDS tests need to use @requires vm.flagless
  • 29b8d3d: 8307573: Implementation of JEP 449: Deprecate the Windows 32-bit x86 Port for Removal
  • 5fc9b57: 8308276: Change layout API to work with bytes, not bits
  • 91aeb5d: 8287834: Add SymbolLookup::or method

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.

➡️ 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 May 17, 2023
@openjdk
Copy link

openjdk bot commented May 18, 2023

@dougxc Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information.

@dougxc
Copy link
Member Author

dougxc commented May 18, 2023

I rebased this PR to remove commits from #14000 that accidentally got cherry-picked into this PR.

@dougxc
Copy link
Member Author

dougxc commented May 22, 2023

@tkrodriguez could you please review fb22509 which I added to handle cases such as oracle/graal#6216 (comment).

@tkrodriguez
Copy link
Contributor

I think the new changes look ok.

MutexLocker locker(_lock);
JavaVM* javaVM = _shared_library_javavm;
if (javaVM == nullptr) {
const char* val = Arguments::PropertyList_get_value(Arguments::system_properties(), "test.jvmci.forceEnomemOnLibjvmciInit");
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that this view on system properties is restricted to properties set at VM startup (e.g. on the command line) and will not see the result of calls to System.setProperty() made by an application.

@dougxc
Copy link
Member Author

dougxc commented May 23, 2023

Thanks for the reviews @tkrodriguez .

/integrate

@openjdk
Copy link

openjdk bot commented May 23, 2023

Going to push as commit 422128b.
Since your change was applied there have been 14 commits pushed to the master branch:

  • fe8c689: 8308038: java/util/concurrent/ThreadPerTaskExecutor/ThreadPerTaskExecutorTest.java timed out
  • ada416e: 8308235: ThreadContainer registry accumulates weak refs
  • 5d8ba93: 8308046: Move Solaris related charsets from java.base to jdk.charsets module
  • 878162b: 8306507: [linux] Print number of memory mappings in error reports
  • 90d5041: 8300086: Replace NULL with nullptr in share/c1/
  • 8474e69: 8308465: Reduce memory accesses in AArch64 MD5 intrinsic
  • f99ad11: 8302218: CHeapBitMap::free frees with incorrect size
  • d77a410: 8308388: Update description of SourceVersion.RELEASE_21
  • 3f4cfbd: 8307190: Refactor ref_at methods in Constant Pool
  • 491bdea: 8308458: Windows build failure with disassembler.cpp(792): warning C4267: '=': conversion from 'size_t' to 'int'
  • ... and 4 more: https://git.openjdk.org/jdk/compare/4f88437b7fc26e1d9b096b535a4dbfd8a9d227f1...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 23, 2023

@dougxc Pushed as commit 422128b.

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

@dougxc dougxc deleted the JDK-8306992 branch August 20, 2024 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants