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

8254874: ZGC: JNIHandleBlock verification failure in stack watermark processing #701

Closed
wants to merge 1 commit into from

Conversation

@stefank
Copy link
Member

@stefank stefank commented Oct 16, 2020

The cm03t001 test creates a local JNI handle in the prepare function. It later uses that handle from a callback function, from another thread. When the callback runs, ZGC applies a load barrier to that handle and self-heals it in the other threads stack. Later when that thread verifies its stack, during the start of its stack processing, it finds that the oop is unexpectedly not "bad".

It's invalid to send a local JNI handle over to another thread:
https://docs.oracle.com/en/java/javase/15/docs/specs/jni/design.html#global-and-local-references

So, my proposed fix is to convert the local handle to a global handle.

I've tested this with the reproducer in the bug report.


Progress

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

Testing

Linux x64 Windows x64 macOS x64
Build ✔️ (5/5 passed) ✔️ (2/2 passed) ✔️ (2/2 passed)
Test (tier1) ✔️ (9/9 passed) ✔️ (9/9 passed) ✔️ (9/9 passed)

Issue

  • JDK-8254874: ZGC: JNIHandleBlock verification failure in stack watermark processing

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/701/head:pull/701
$ git checkout pull/701

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 16, 2020

👋 Welcome back stefank! 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.

Loading

@openjdk openjdk bot added the rfr label Oct 16, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 16, 2020

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

  • serviceability

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.

Loading

@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 16, 2020

Webrevs

Loading

@stefank
Copy link
Member Author

@stefank stefank commented Oct 16, 2020

/label add hotspot-gc

Loading

@openjdk openjdk bot added the hotspot-gc label Oct 16, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 16, 2020

@stefank
The hotspot-gc label was successfully added.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Oct 16, 2020

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

8254874: ZGC: JNIHandleBlock verification failure in stack watermark processing

Reviewed-by: tschatzl, cjplummer, sspitsyn, pliden

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

  • 0b3e6c5: 8194126: Regression automated Test '/open/test/jdk/javax/swing/JColorChooser/Test7194184.java' fails
  • ce1aac1: 8028707: javax/swing/JComboBox/6236162/bug6236162.java fails on azure
  • 83ea863: 8253559: The INDEX page should link to Serialized Form and Constant Values pages
  • e66c6bb: 8254349: The TestNoScreenMenuBar test should be updated
  • 402d01a: 8254795: Remove obsolete template files
  • 07ec35e: 8254623: gc/g1/TestHumongousConcurrentStartUndo.java still fails sometimes

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.

Loading

@openjdk openjdk bot added the ready label Oct 16, 2020
Copy link
Contributor

@plummercj plummercj left a comment

The changes look good. It is confusing however that klass is also a local variable in a few functions, hiding the static version from scope, but this is a pre-existing problem.

Loading

Copy link
Contributor

@sspitsyn sspitsyn left a comment

Hi Stefan,
The fix looks good.
Thank you for catching this.
The test has 4 more static variables which are not used in the events handlers.
Thanks,
Serguei

Loading

pliden
pliden approved these changes Oct 17, 2020
@stefank
Copy link
Member Author

@stefank stefank commented Oct 19, 2020

Thanks for reviewing!

Loading

@stefank
Copy link
Member Author

@stefank stefank commented Oct 19, 2020

/integrate

Loading

@openjdk openjdk bot closed this Oct 19, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Oct 19, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 19, 2020

@stefank Since your change was applied there have been 13 commits pushed to the master branch:

  • 98a395a: 8254880: ZGC: Let ZList iterators be alias templates
  • 011dd0d: 8254824: SignalHandlerMark have no purpose
  • 736e077: 8254178: Remove .hgignore
  • 51a865d: 8254085: javax/swing/text/Caret/TestCaretPositionJTextPane.java failed with "RuntimeException: Wrong caret position"
  • dd032b7: 8254798: Deprecate for removal an empty finalize() methods in java.desktop module
  • 272bb5d: 8253455: Record Classes javax.lang.model changes
  • c17d585: 8246774: implement Record Classes as a standard feature in Java
  • 0b3e6c5: 8194126: Regression automated Test '/open/test/jdk/javax/swing/JColorChooser/Test7194184.java' fails
  • ce1aac1: 8028707: javax/swing/JComboBox/6236162/bug6236162.java fails on azure
  • 83ea863: 8253559: The INDEX page should link to Serialized Form and Constant Values pages
  • ... and 3 more: https://git.openjdk.java.net/jdk/compare/0570cc10b579580f37b8978f2498459bdd4c870b...master

Your commit was automatically rebased without conflicts.

Pushed as commit 672f566.

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

Loading

@stefank stefank deleted the 8254874_cm03t001 branch Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants