JDK-8258380 : [JVMCI] don't clear InstalledCode reference when unloading JVMCI nmethods
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,15,16,17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-12-15
  • Updated: 2022-03-17
  • Resolved: 2020-12-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 16 JDK 17
11.0.11-oracleFixed 16 b29Fixed 17Fixed
Description
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 clearing 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.
Comments
https://github.com/graalvm/labs-openjdk-11/commit/e22ca13cac4435a6285236155d1b069266cfff9b
12-01-2021

Fix was pushed to JDK 16 while main bug was targeted to JDK 17. Reset the main bug to be fixed in JDK 16 and copied the Robo Duke entry here. See https://openjdk.java.net/guide/#how-to-fix-an-incorrect-backport-creation for details.
16-12-2020

Changeset: 1f556d22 Author: Tom Rodriguez <never@openjdk.org> Date: 2020-12-15 21:31:00 +0000 URL: https://git.openjdk.java.net/jdk16/commit/1f556d22
16-12-2020

I have moved the change to https://github.com/openjdk/jdk16/pull/25
15-12-2020

[~never] please note that the PR will push this to JDK 17. If this should be fixed in JDK 16, please re-open a PR for JDK 16 or backport once this got pushed to JDK 17.
15-12-2020

[~never] please push to JDK 16. It will be automatically propagated to 17 at this stage.
15-12-2020

ILW = Crash during nmethod unloading, intermittent with jvmci, disable nmethod unloading = HLM = P3
15-12-2020