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

8268364: jmethod clearing should be done during unloading #2935

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

krk
Copy link

@krk krk commented Sep 18, 2024

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 async-profiler/async-profiler#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

  • 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
  • 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

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 18, 2024

👋 Welcome back krk! 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 Sep 18, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport 3d84398d128bb2eed6280ebbc3f57afb3b89908f 8268364: jmethod clearing should be done during unloading Sep 18, 2024
@openjdk
Copy link

openjdk bot commented Sep 18, 2024

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport rfr Pull request is ready for review labels Sep 18, 2024
@krk
Copy link
Author

krk commented Sep 18, 2024

  • MacOS builds are failing for unrelated reason: error: 'sprintf' is deprecated.
  • linux-x86 / test - Test (tier1) failing while uploading test artifacts:
Error: Failed to CreateArtifact: Failed to make request after 5 attempts: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact

@mlbridge
Copy link

mlbridge bot commented Sep 18, 2024

Webrevs

@krk
Copy link
Author

krk commented Sep 19, 2024

cc @coleenp @fisk

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

This looks like a good backport.

@openjdk
Copy link

openjdk bot commented Sep 19, 2024

⚠️ @krk This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@krk
Copy link
Author

krk commented Sep 20, 2024

/approval request The fix is required to allow JVM TI tools, especially profilers, run safely with class unloading enabled. Low risk: a small localized change that only affects liveness of jmethodIDs.

@openjdk
Copy link

openjdk bot commented Sep 20, 2024

@krk
8268364: The approval request has been created successfully.

@openjdk openjdk bot added the approval label Sep 20, 2024
@krk
Copy link
Author

krk commented Oct 2, 2024

/approval request All checks passing. The fix is required to allow JVM TI tools, especially profilers, to run safely with class unloading enabled. Low risk: a small localized change that only affects liveness of jmethodIDs.

@openjdk
Copy link

openjdk bot commented Oct 2, 2024

@krk
8268364: The approval request has been updated successfully.

@shipilev
Copy link
Member

@GoeLin, @jerboaa -- do you see any blockers for approving this?

@jerboaa
Copy link
Contributor

jerboaa commented Oct 29, 2024

@shipilev JDK 11u is done and only very select fixes will be allowed in going forward. For this one, I'll let @theRealAph handle approval. On the surface it seems OK, but it's another change to a done release which only seems to affect corner cases (profilers when classes get unloaded).

FWIW, SAP stopped work on JDK 11u (11.0.25 was the last one) so you can not expect answers from them for 11u.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval backport rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants