jdk11u-dev icon indicating copy to clipboard operation
jdk11u-dev copied to clipboard

8268364: jmethod clearing should be done during unloading

Open krk opened this issue 5 months ago • 9 comments

Backport of 8268364, single hunk conflict resolved by accepting "empty" from the backport commit vs. clear_jmethod_ids invocation in the dtor. Backport commit moves the clear_jmethod_ids invocation to unload method instead.

It fixes crashes when accessing jmethodIDs of a class being unloaded.

Here is the reproducer that crashes JVM in ~1 second without the patch, but works fine with it: gist.

This fix also resolves the issue reported at https://github.com/async-profiler/async-profiler/issues/974 for Java 11.

To run the repro:

javac Main.java
gcc -shared -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/linux" -fPIC repro.cpp -orepro.so

java -agentpath:"$(pwd)/repro.so" -Xmx100m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+ExplicitGCInvokesConcurrent Main

Progress

  • [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue
  • [ ] JDK-8268364 needs maintainer approval

Warning

 ⚠️ Found leading lowercase letter in issue title for 8268364: jmethod clearing should be done during unloading

Issue

  • JDK-8268364: jmethod clearing should be done during unloading (Bug - P4 - Requested)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/2935/head:pull/2935
$ git checkout pull/2935

Update a local copy of the PR:
$ git checkout pull/2935
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/2935/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2935

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/2935.diff

Webrev

Link to Webrev Comment

krk avatar Sep 18 '24 15:09 krk