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

8048190: NoClassDefFoundError omits original ExceptionInInitializerError #4996

Closed
wants to merge 14 commits into from

Conversation

coleenp
Copy link
Contributor

@coleenp coleenp commented Aug 4, 2021

This is a change to save the class initialization error stack trace in a hashtable and return it as the cause when NoClassDefFoundError is thrown. The first commit is a more limited version of this that just changes the message, by adding to the message string. The second commit is getting and saving the stack trace for the original exception, and using the thread in the message. See CR for more details about how the message looks.

Tested with tier1-3 tests on 3 platforms. Tier 4-6 in progress (all but two done and passed).


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8048190: NoClassDefFoundError omits original ExceptionInInitializerError

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4996/head:pull/4996
$ git checkout pull/4996

Update a local copy of the PR:
$ git checkout pull/4996
$ git pull https://git.openjdk.java.net/jdk pull/4996/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4996

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4996.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 4, 2021

👋 Welcome back coleenp! 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 label Aug 4, 2021
@openjdk
Copy link

openjdk bot commented Aug 4, 2021

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

  • hotspot

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 label Aug 4, 2021
@mlbridge
Copy link

mlbridge bot commented Aug 4, 2021

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Hi Coleen,

This was not quite what I had envisaged but initially I thought this looked really neat. However on further thought I think there are a number of potential problems with trying to re-create the original type of exception. The "exception" type may not exist or is not known to the current loader, or the "exception" type does not follow convention and have a string-taking constructor. But also for user-defined exception types you have no idea what execution context might be assumed by the exception constructor logic, or what that logic may do. It may be completely wrong/bad to try and create an exception of that type from the current thread in the current context.

Further comments/suggestions below.

Thanks,
David

src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
src/hotspot/share/oops/instanceKlass.cpp Show resolved Hide resolved
src/hotspot/share/oops/instanceKlass.cpp Outdated Show resolved Hide resolved
src/hotspot/share/oops/instanceKlass.cpp Outdated Show resolved Hide resolved
src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
Copy link
Contributor Author

@coleenp coleenp left a comment

David, thank you for all the comments.

src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
src/hotspot/share/oops/instanceKlass.cpp Show resolved Hide resolved
src/hotspot/share/oops/instanceKlass.cpp Outdated Show resolved Hide resolved
src/hotspot/share/oops/instanceKlass.cpp Outdated Show resolved Hide resolved
src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
…ve an oop. (Could potentially move to Doug's secret Class location. If the exception is not bootstrap exception, throw EIIE instead with message of original exception.
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Hi Coleen,

Still thinking about the details of this. One concern below, and a few minor comments.

Thanks,
David

src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
src/hotspot/share/classfile/javaClasses.cpp Outdated Show resolved Hide resolved
@coleenp
Copy link
Contributor Author

coleenp commented Aug 9, 2021

@dholmes-ora Thanks for looking at this in detail. It does a lot during initialization error so useful to be cautious. I was thinking of maybe having a diagnostic option to turn it off in case some application down the line finds it's doing too much or one that has a lot of initialization errors that blow up the table.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Hi Coleen,

Functional changes look good!

A couple of nits with the test.

Thanks,
David

@openjdk
Copy link

openjdk bot commented Aug 10, 2021

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

8048190: NoClassDefFoundError omits original ExceptionInInitializerError

Reviewed-by: dholmes, iklam

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

  • bd27bb9: 8272345: macos doesn't check os::set_boot_path() result
  • 44f137f: 8271170: Add unit test for what jpackage app launcher puts in the environment
  • cd2dbe5: 8272328: java.library.path is not set properly by Windows jpackage app launcher
  • 9faab40: 8272330: C2: Cleanup profile counter scaling
  • 75a0642: 8272335: runtime/cds/appcds/MoveJDKTest.java doesn't check exit codes
  • 9ba8a12: 8269774: doclint reports missing javadoc comments for JavaFX properties if the docs are on the property method
  • ec8d3ba: 8271159: [REDO] JDK-8249634 doclint should report implicit constructor as missing javadoc comments
  • 6194227: 8272228: G1: G1CardSetInlinePtr Fix tautological assertion
  • cd1751c: 8271884: G1CH::_expand_heap_after_alloc_failure is no longer needed
  • 3f723ca: 8271862: C2 intrinsic for Reference.refersTo() is often not used
  • ... and 21 more: https://git.openjdk.java.net/jdk/compare/eb6f3fe59d469a369383a750d319318909cf8613...master

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 label Aug 10, 2021
Copy link
Contributor Author

@coleenp coleenp left a comment

Thanks for the review and additional suggestions.

Copy link
Member

@iklam iklam left a comment

Looks good overall. Some minor nits.

src/hotspot/share/oops/instanceKlass.cpp Outdated Show resolved Hide resolved
src/hotspot/share/oops/instanceKlass.cpp Outdated Show resolved Hide resolved
src/hotspot/share/oops/instanceKlass.cpp Outdated Show resolved Hide resolved
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Updates look good.

Thanks,
David

iklam
iklam approved these changes Aug 12, 2021
Copy link
Member

@iklam iklam left a comment

LGTM

@coleenp
Copy link
Contributor Author

coleenp commented Aug 12, 2021

Thank you David and Ioi for your reviews and comments!
/integrate

@openjdk
Copy link

openjdk bot commented Aug 12, 2021

Going to push as commit 464e874.
Since your change was applied there have been 36 commits pushed to the master branch:

  • 7e14c3c: 8272310: AArch64: Add missing changes for shared vector helper methods in m4 files
  • b29fbad: 8267844: Replace Integer/Long.valueOf() with Integer/Long.parse*() where applicable
  • d38b314: 8272332: --with-harfbuzz=system doesn't add -lharfbuzz after JDK-8255790
  • a15b659: 8271732: Regression in StringBuilder.charAt bounds checking
  • ec2fc38: 8272120: Avoid looking for standard encodings in "java." modules
  • bd27bb9: 8272345: macos doesn't check os::set_boot_path() result
  • 44f137f: 8271170: Add unit test for what jpackage app launcher puts in the environment
  • cd2dbe5: 8272328: java.library.path is not set properly by Windows jpackage app launcher
  • 9faab40: 8272330: C2: Cleanup profile counter scaling
  • 75a0642: 8272335: runtime/cds/appcds/MoveJDKTest.java doesn't check exit codes
  • ... and 26 more: https://git.openjdk.java.net/jdk/compare/eb6f3fe59d469a369383a750d319318909cf8613...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Aug 12, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Aug 12, 2021
@openjdk
Copy link

openjdk bot commented Aug 12, 2021

@coleenp Pushed as commit 464e874.

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

@coleenp coleenp deleted the init-oom branch Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot integrated
5 participants