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 1 year 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

:wave: 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.

bridgekeeper[bot] avatar Sep 18 '24 15:09 bridgekeeper[bot]

@krk This change now passes all automated pre-integration checks.

After integration, the commit message for the final commit will be:

8268364: jmethod clearing should be done during unloading

Reviewed-by: coleenp

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

  • 1c80800a26fee6b1760b63bcfae672e232c639f7: 8340552: Harden TzdbZoneRulesCompiler against missing zone names
  • 874b25e64174ba64efec9b61229f3f610133270a: 8339637: (tz) Update Timezone Data to 2024b
  • 2155f8d22a5e34d9b9386485b2a6a1c2bdf8b52c: 8339803: Acknowledge case insensitive unambiguous keywords in tzdata files
  • c99638d35c8aea16eae244d26bc4ab8dcb080788: 8335801: [11u] Backport of 8210988 to 11u removes gcc warnings
  • 513a67a65f2d1198c6b6f84c2e21e60e02566690: 8303920: Avoid calling out to python in DataDescriptorSignatureMissing test
  • cf53387daf0d99e2d426e5e9a35e8d79b9701485: 8342629: [11u] Properly message out that shenandoah is disabled
  • 249144c02be9d0e51bef1b3a88bd8eeadb5a8d2f: 8225045: javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java fails on linux-x64
  • 04e6f37d2c3b0983db92184f49391b4453b459df: 8247706: Unintentional use of new Date(year...) with absolute year
  • add90003d601eec60cf9166f6013f0e86382729d: 8232367: Update Reactive Streams to 1.0.3 -- tests only
  • 827528c3228705496813887f92f964310b010464: 8339470: [17u] More defensive fix for 8163921
  • ... and 23 more: https://git.openjdk.org/jdk11u-dev/compare/2232d1f7b497d782edb6fa5f41ec9fd2a90ca33d...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@coleenp) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

openjdk[bot] avatar Sep 18 '24 15:09 openjdk[bot]

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

openjdk[bot] avatar Sep 18 '24 15:09 openjdk[bot]

  • 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

krk avatar Sep 18 '24 15:09 krk

Webrevs

mlbridge[bot] avatar Sep 18 '24 15:09 mlbridge[bot]

cc @coleenp @fisk

krk avatar Sep 19 '24 15:09 krk

⚠️ @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.

openjdk[bot] avatar Sep 19 '24 19:09 openjdk[bot]

/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.

krk avatar Sep 20 '24 10:09 krk

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

openjdk[bot] avatar Sep 20 '24 10:09 openjdk[bot]

/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.

krk avatar Oct 02 '24 14:10 krk

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

openjdk[bot] avatar Oct 02 '24 14:10 openjdk[bot]

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

shipilev avatar Oct 29 '24 12:10 shipilev

@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.

jerboaa avatar Oct 29 '24 13:10 jerboaa

@krk This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Nov 26 '24 15:11 bridgekeeper[bot]

@krk @shipilev Andrew Haley has approved this PR. Do you plan to integrate it?

jerboaa avatar Dec 04 '24 08:12 jerboaa

/integrate

krk avatar Dec 04 '24 10:12 krk

@krk Your change (at version 032138d9fd15e0bd70f9d93a99cab5eafe88dd34) is now ready to be sponsored by a Committer.

openjdk[bot] avatar Dec 04 '24 10:12 openjdk[bot]

/sponsor

shipilev avatar Dec 04 '24 10:12 shipilev

Going to push as commit 50da3f663a52255bc17b72ab78709b34d635dd7a. Since your change was applied there have been 33 commits pushed to the master branch:

  • 1c80800a26fee6b1760b63bcfae672e232c639f7: 8340552: Harden TzdbZoneRulesCompiler against missing zone names
  • 874b25e64174ba64efec9b61229f3f610133270a: 8339637: (tz) Update Timezone Data to 2024b
  • 2155f8d22a5e34d9b9386485b2a6a1c2bdf8b52c: 8339803: Acknowledge case insensitive unambiguous keywords in tzdata files
  • c99638d35c8aea16eae244d26bc4ab8dcb080788: 8335801: [11u] Backport of 8210988 to 11u removes gcc warnings
  • 513a67a65f2d1198c6b6f84c2e21e60e02566690: 8303920: Avoid calling out to python in DataDescriptorSignatureMissing test
  • cf53387daf0d99e2d426e5e9a35e8d79b9701485: 8342629: [11u] Properly message out that shenandoah is disabled
  • 249144c02be9d0e51bef1b3a88bd8eeadb5a8d2f: 8225045: javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java fails on linux-x64
  • 04e6f37d2c3b0983db92184f49391b4453b459df: 8247706: Unintentional use of new Date(year...) with absolute year
  • add90003d601eec60cf9166f6013f0e86382729d: 8232367: Update Reactive Streams to 1.0.3 -- tests only
  • 827528c3228705496813887f92f964310b010464: 8339470: [17u] More defensive fix for 8163921
  • ... and 23 more: https://git.openjdk.org/jdk11u-dev/compare/2232d1f7b497d782edb6fa5f41ec9fd2a90ca33d...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Dec 04 '24 10:12 openjdk[bot]

@shipilev @krk Pushed as commit 50da3f663a52255bc17b72ab78709b34d635dd7a.

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

openjdk[bot] avatar Dec 04 '24 10:12 openjdk[bot]

@krk @shipilev Andrew Haley has approved this PR. Do you plan to integrate it?

This really should have waited until the rampdown changes were in place. I've manually moved this one to 11.0.27.

gnu-andrew avatar Dec 04 '24 16:12 gnu-andrew

Sorry for the confusion, thanks for moving it.

krk avatar Dec 04 '24 16:12 krk

Sorry for the confusion, thanks for moving it.

Thanks. I'm a little late in doing the transition myself with being away at the beginning of the week, but the right version should be used automatically once https://bugs.openjdk.org/browse/JDK-8345509 is integrated. I just thought you should be aware that this will be in the April release. The cut-off for January was Friday.

gnu-andrew avatar Dec 04 '24 16:12 gnu-andrew