-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8309034: NoClassDefFoundError when initializing Long$LongCache #14438
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
Conversation
👋 Welcome back dholmes! A progress list of the required criteria for merging this PR into |
@dholmes-ora 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. |
/label add hotspot-runtime |
@dholmes-ora |
@dholmes-ora |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Looks good to me. Thanks for fixing this.
@dholmes-ora 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 96 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 |
Thanks @coleenp ! |
test/hotspot/jtreg/runtime/ClassInitErrors/TestOutOfMemoryDuringInit.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
Thank you for making those initialization issues easier to investigate.
Thanks for the review @fparain ! /integrate |
Going to push as commit 4c3efb3.
Your commit was automatically rebased without conflicts. |
@dholmes-ora Pushed as commit 4c3efb3. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
When a class fails to initialize we try to preserve information about the original cause of the failure in a constructed
ExceptionInInitializerError
so that the EIIE can be attached to subsequentNoClassDefFoundError
s thrown when an erroneous class is later accessed. If construction of the EIIE itself throws an exception we presently do nothing and the original problem is lost. The main reasons we would fail to create the EIIE are because we throwOutOfMemoryError
orStackOverflowError
. If the original class initialization failed due to stackoverflow then it is very likely the attempt to create the EIIE will as well. This leads to a situation, as per the obscure message in the bug synopsis, where you get totally unexpected failure modes with nothing to tell that the stackoverflow was the original cause. You would need to enable VM exception logging to try and determine that.This enhancement improves the current situation by setting the cause of the class initialization failure to be a
StackOverflowError
orOutOfMemoryError
, if the original failure was the same, and the attempt to create the EIIE fails. We cannot create these dynamically of course (else we'd have created the EIIE) so these are pre-allocated, stackless shared instances, created a VM startup. The preallocatedOutOfMemoryError
already exists so we just added a pre-allocatedStackOverflowError
. Now when we get theNoClassDefFoundError
instead of the obscure and uninformative:we now see an additional piece of information to shed light on the original issue:
Testing:
Tiers 1-3 sanity testing
The original reproducer was adapted into a regression test, but it was discovered that the failure mode was only observed on x64 systems (not unexpected as different architectures have different stack requirements and so will exhibit different stackoverflow behaviour). This was run 50 times on each x64 platform to check for intermittent failures. As we know this test could be fragile I also marked it as requiring
vm.flagless
just to be safe.A regression test was also created for the out-of-memory condition. This test seems quite stable across all platforms, and again was tested 50 times on each.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14438/head:pull/14438
$ git checkout pull/14438
Update a local copy of the PR:
$ git checkout pull/14438
$ git pull https://git.openjdk.org/jdk.git pull/14438/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14438
View PR using the GUI difftool:
$ git pr show -t 14438
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14438.diff
Webrev
Link to Webrev Comment