Skip to content

Conversation

@dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Dec 5, 2022

When JNI reports errors and warnings and produces a stack trace, we need to see the exact Java code that was being executed. The existing JavaThread::print_stack that is used is only for platform/carrier threads and doesn't show any mounted virtual thread. So we introduce a new JavaThread::print_virtual_stack_on method to print the mounted virtual thread's stack, and we add JavaThread::print_jni_stack as a utility for JNI to call that dispatches to the appropriate function based on the thread type.

The existing test hotspot/jtreg/runtime/jni/checked/TestPrimitiveArrayCriticalWithBadParam.java was modified to test regular and virtual threads, and to expect to see the specific stack frame of the Java native method.

Additional manual testing of the JNI FatalError method was done by direct fault injection in modified JDK code.

Sanity testing: Oracle tiers 1-4 (to include our -Xcheck:jni run in tier4)

Thanks,
David


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-8292674: ReportJNIFatalError should print all java frames

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11503

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 5, 2022

👋 Welcome back dholmes! 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 Dec 5, 2022

@dholmes-ora 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 hotspot-dev@openjdk.org label Dec 5, 2022
@dholmes-ora dholmes-ora marked this pull request as ready for review December 6, 2022 00:02
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 6, 2022
@mlbridge
Copy link

mlbridge bot commented Dec 6, 2022

Webrevs

@dholmes-ora
Copy link
Member Author

/label add loom

@openjdk
Copy link

openjdk bot commented Dec 6, 2022

@dholmes-ora
The label loom is not a valid label.
These labels are valid:

  • serviceability
  • hotspot
  • hotspot-compiler
  • ide-support
  • kulla
  • i18n
  • shenandoah
  • jdk
  • javadoc
  • security
  • hotspot-runtime
  • jmx
  • build
  • nio
  • client
  • core-libs
  • compiler
  • net
  • hotspot-gc
  • hotspot-jfr

Copy link
Contributor

@pchilano pchilano 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. Some comments below.

Thanks,
Patricio

@dholmes-ora
Copy link
Member Author

Thanks for looking at this @pchilano . I've made changes and will re-test before updating the PR. I'm retargetting this to JDK 21 now.

Copy link
Contributor

@pchilano pchilano 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, thanks David!

@openjdk
Copy link

openjdk bot commented Dec 8, 2022

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

8292674: ReportJNIFatalError should print all java frames

Reviewed-by: pchilanomate

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:

  • 7f9c6ce: 8297679: InvocationTargetException field named target is not declared final
  • 5540a8c: 8298083: The "CheckBox/RadioButton[Enabled/Disabled].textForeground" stoped working
  • c16eb89: 8298138: Shenandoah: HdrSeq asserts "sub-bucket index (512) overflow for value ( 1.00)"

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 Dec 8, 2022
@robehn
Copy link
Contributor

robehn commented Dec 9, 2022

Looks good, thanks!

@dholmes-ora
Copy link
Member Author

Thanks for looking at this @robehn , but can you hit the approve button please :)

@dholmes-ora
Copy link
Member Author

Seems Robbin is not around.

/integrate

@openjdk
Copy link

openjdk bot commented Dec 13, 2022

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

  • be69930: 8288287: Remove expired flags in JDK 21
  • c3bc4fc: 8297505: Declare fields in some sun.security.pkcs11 classes as final
  • c7aca73: 8295857: Clarify that cleanup code can be skipped when the JVM terminates (e.g. when calling halt())
  • 781a2e0: 8298343: "Could not confirm if TargetJDK is hardened." warning for SA tests on macosx-aarch64-debug
  • 9ff85f6: 8298589: java/net/SctpSanity.java fail with NoClassDefFoundError: sun/nio/ch/sctp/UnsupportedUtil
  • 81f57d5: 8298567: Make field in RandomAccessFile final
  • 56c438b: 8297822: De-duplicate code in module jdk.sctp
  • fabda24: 8296389: C2: PhaseCFG::convert_NeverBranch_to_Goto must handle both orders of successors
  • 6c23b4f: 8298480: Remove unused KlassRemSet
  • 8e5c331: 8298471: Parallel: Don't keep alive nmethods in Young GC
  • ... and 26 more: https://git.openjdk.org/jdk/compare/3dfadeebd023efb03a400f2b2656567a4154421a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Dec 13, 2022

@dholmes-ora Pushed as commit 829cbc2.

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

@dholmes-ora dholmes-ora deleted the 8292674-ReportJNIFatalError-v2 branch December 13, 2022 00:05
@robehn
Copy link
Contributor

robehn commented Dec 13, 2022

Sorry, not sure why I missed your ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Development

Successfully merging this pull request may close these issues.

4 participants