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

8260621: Avoid memory leak in ImageBufferCache #2307

Closed
wants to merge 1 commit into from

Conversation

blindpirate
Copy link
Contributor

@blindpirate blindpirate commented Jan 29, 2021

Previously, ImageBufferCache contains a ThreadLocal field which holds
strong reference to ImageBufferCache$BufferReference.class. When loaded
from jrt-fs.jar, this will keep JrtFileSystemProvider$JrtFsLoader
in memory forever and never being GCed.

The fix replace the old ImageBufferCache$BufferReference class with
WeakReference<ByteBuffer>, which is verified by provided test.


Progress

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

Integration blocker

 ⚠️ Title mismatch between PR and JBS for issue JDK-8260621

Issue

  • JDK-8260621: (jrtfs) ThreadLocal memory leak in ImageBufferCache when using jrtfs ⚠️ Title mismatch between PR and JBS. ⚠️ Issue is not open.

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/2307/head:pull/2307
$ git checkout pull/2307

Update a local copy of the PR:
$ git checkout pull/2307
$ git pull https://git.openjdk.java.net/jdk pull/2307/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2307

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/2307.diff

@bridgekeeper bridgekeeper bot added the oca Needs verification of OCA signatory status label Jan 29, 2021
@bridgekeeper
Copy link

bridgekeeper bot commented Jan 29, 2021

Hi @blindpirate, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user blindpirate" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

@openjdk
Copy link

openjdk bot commented Jan 29, 2021

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

  • core-libs

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 core-libs core-libs-dev@openjdk.org label Jan 29, 2021
@blindpirate
Copy link
Contributor Author

/signed

@bridgekeeper bridgekeeper bot added the oca-verify Needs verification of OCA signatory status label Jan 29, 2021
@bridgekeeper
Copy link

bridgekeeper bot commented Jan 29, 2021

Thank you! Please allow for up to two weeks to process your OCA, although it is usually done within one to two business days. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated!

@bridgekeeper bridgekeeper bot removed oca Needs verification of OCA signatory status oca-verify Needs verification of OCA signatory status labels Feb 3, 2021
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 3, 2021
@mlbridge
Copy link

mlbridge bot commented Feb 3, 2021

Webrevs

Previously, `ImageBufferCache` contains a ThreadLocal field which holds
strong reference to `ImageBufferCache$BufferReference.class`. When loaded
from `jrt-fs.jar`, this will keep `JrtFileSystemProvider$JrtFsLoader`
in memory forever and never being GCed.

The fix replace the old `ImageBufferCache$BufferReference` class with
`WeakReference<ByteBuffer>`, which is verified by provided test.
@mlbridge
Copy link

mlbridge bot commented Feb 8, 2021

Mailing list message from Bo Zhang on core-libs-dev:

Request for review, thanks!

@openjdk
Copy link

openjdk bot commented Mar 17, 2021

@blindpirate Unknown command signed - for a list of valid commands use /help.

@openjdk
Copy link

openjdk bot commented Mar 29, 2021

@blindpirate This change is no longer ready for integration - check the PR body for details.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed ready Pull request is ready to be integrated labels Mar 29, 2021
Copy link
Member

@JimLaskey JimLaskey left a comment

Choose a reason for hiding this comment

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

An alternate approach is pending.

@openjdk
Copy link

openjdk bot commented May 5, 2021

@blindpirate this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout jdk-8260621
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed rfr Pull request is ready for review labels May 5, 2021
@AlanBateman
Copy link
Contributor

This issue was fixed with PR 3849 so I assume PR 2307 can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org merge-conflict Pull request has merge conflict with target branch
3 participants