8326615: C1/C2 don't handle allocation failure properly during initialization (RuntimeStub::new_runtime_stub fatal crash)#19280
8326615: C1/C2 don't handle allocation failure properly during initialization (RuntimeStub::new_runtime_stub fatal crash)#19280dafedafe wants to merge 29 commits intoopenjdk:masterfrom
Conversation
…nal Error (codeBlob.cpp:429) Initial size of CodeCache is too small
|
👋 Welcome back dfenacci! A progress list of the required criteria for merging this PR into |
|
@dafedafe 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 37 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 |
|
@dafedafe this pull request can not be integrated into git checkout JDK-8326615
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
Webrevs
|
TobiHartmann
left a comment
There was a problem hiding this comment.
This is not a regression in JDK 23, right? Could you please adjust the affects versions in JIRA accordingly?
Looks good to me otherwise.
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
It is not. Fixing the version. |
| @@ -280,6 +285,7 @@ void Runtime1::initialize(BufferBlob* blob) { | |||
| #endif | |||
| BarrierSetC1* bs = BarrierSet::barrier_set()->barrier_set_c1(); | |||
| bs->generate_c1_runtime_stubs(blob); | |||
There was a problem hiding this comment.
Don't we need to handle failures in generate_c1_runtime_stubs? With the assert removed, I think we'll get a nullptr crash.
There was a problem hiding this comment.
Yep, you're right. Actually that call could potentially fail too.
I've added code to handle that case as well.
Thanks @dean-long!
TobiHartmann
left a comment
There was a problem hiding this comment.
Looks good to me otherwise.
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
Thanks for the review @TobiHartmann! |
|
This looks OK, but isn't it a lot of changes just to get this test to pass? Aren't all of these allocation failures ultimately fatal? Is there a simpler way to handle this problem? |
It seems a bit much indeed but I think there is potentially always the possibility of not failing but only disabling the compiler. @dean-long do you think the VM would anyway fail later on? |
| #include "c1/c1_Compiler.hpp" | ||
| #include "opto/c2compiler.hpp" |
There was a problem hiding this comment.
These should be also under COMPILER*_PRESENT macros.
TobiHartmann
left a comment
There was a problem hiding this comment.
That looks good to me too.
|
Thanks @vnkozlov @TobiHartmann for your reviews! |
|
/integrate |
|
Going to push as commit 633fad8.
Your commit was automatically rebased without conflicts. |
Issue
The test
compiler/startup/StartupOutput.javafails intermittently due to a crash after correctly printing the errorInitial size of CodeCache is too small(the test limits the code cache using-XX:InitialCodeCacheSize=1024K -XX:ReservedCodeCacheSize=1200k).The appearance of the issue is very dependent on thread scheduling. The original report happens during C1 initialization but C2 initialization is affected as well.
Causes
There is one occurrence during C1 initialization and one during C2 initialization where a call to
RuntimeStub::new_runtime_stubcan fail fatally if there is not enough space left.For C1:
Compiler::init_c1_runtime->Runtime1::initialize->Runtime1::generate_blob_for->Runtime1::generate_blob->RuntimeStub::new_runtime_stub.For C2:
C2Compiler::initialize->OptoRuntime::generate->OptoRuntime::generate_stub->Compile::Compile->Compile::Code_Gen->PhaseOutput::install->PhaseOutput::install_stub->RuntimeStub::new_runtime_stub.Solution
Instead of avoiding the crash it makes more sense to increase the minimum code cache size by adding the size of the minimal code cache needed for C1 and C2 to
CodeCacheMinimumUseSpace.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19280/head:pull/19280$ git checkout pull/19280Update a local copy of the PR:
$ git checkout pull/19280$ git pull https://git.openjdk.org/jdk.git pull/19280/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19280View PR using the GUI difftool:
$ git pr show -t 19280Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19280.diff
Webrev
Link to Webrev Comment