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

8258380: [JVMCI] don't clear InstalledCode reference when unloading JVMCI nmethods #1777

Closed
wants to merge 1 commit into from

Conversation

tkrodriguez
Copy link
Contributor

@tkrodriguez tkrodriguez commented Dec 15, 2020

We have been getting crashes running our unit tests in our gates with JDK15. The crashes are mostly in nmethod::is_unloaded because IsUnloadingBehaviour::current() is null. It seemed like there was some inconsistency in the notion of is_unloading for JVMCI nmethods that was leading to the crashes. I noticed that the is_unloading path rescans the nmethod using a closure to determine if it's unloading and since make_unloaded will clear the InstalledCode reference at the end if you ran the closure again it might return false since the oop is now null instead of being an unmarked oop. There's no point in the clearly the oop in this path anyway since the nmethod is dead and leaving the oop around seem to solve this crash. We're only see this crash in 15 but I don't see why it couldn't occur in 11 or later.


Progress

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

Issue

  • JDK-8258380: [JVMCI] don't clear InstalledCode reference when unloading JVMCI nmethods

Reviewers

Download

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

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 15, 2020

👋 Welcome back never! 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 Pull request is ready for review label Dec 15, 2020
@openjdk
Copy link

openjdk bot commented Dec 15, 2020

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

  • hotspot-compiler

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-compiler hotspot-compiler-dev@openjdk.org label Dec 15, 2020
@mlbridge
Copy link

mlbridge bot commented Dec 15, 2020

Webrevs

@tkrodriguez
Copy link
Contributor Author

@fisk any thoughts on this bug?

Copy link
Contributor

@fisk fisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. It is definitely assumed that the transition to is_unloading() is completely monotonic. And it seems like the clearing could violate that indeed.
Worth noticing is that with concurrent class unloading, the make_unloaded operation is split into two: 1. unlinking, 2. deleting stuff. This operation would go under unlinking. Hence, it would need to check for is_unloading instead of is_unloaded, as the unlinking happens before the nmethod becomes unloaded. But we can cross that bridge when we get there I suppose. Looks good.

@openjdk
Copy link

openjdk bot commented Dec 15, 2020

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

8258380: [JVMCI] don't clear InstalledCode reference when unloading JVMCI nmethods

Reviewed-by: eosterlund

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 1 new commit pushed to the master branch:

  • 3ab1dfe: 8257828: SafeFetch may crash if invoked in non-JavaThreads

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 15, 2020
Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in JBS report this fix needs to be re-based to JDK 16 repo (with new PR) and pushed there.
It will be automatically forward ported into JDK 17 later.

@tkrodriguez
Copy link
Contributor Author

Moved to openjdk/jdk16#25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org ready Pull request is ready to be integrated rfr Pull request is ready for review
3 participants