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

JDK-8273902: Memory leak in OopStorage due to bug in OopHandle::release() #5549

Closed
wants to merge 1 commit into from

Conversation

@simonis
Copy link
Member

@simonis simonis commented Sep 16, 2021

Currently, OopHandle::release() is implemented as follows:

inline void OopHandle::release(OopStorage* storage) {
  if (peek() != NULL) {
    // Clear the OopHandle first
    NativeAccess<>::oop_store(_obj, (oop)NULL);
    storage->release(_obj);
  }
}

However, peek() returns NULL not only if the oop* _obj is NULL, but also when _obj points to a zero oop. In the latter case, the oop* _obj will not be released from the corresponding OopStorage and the slot it occupies will remain alive forever.

This behavior can be easily triggered with the LeakTestMinimal.java test which is attached to the JBS issue(thanks to Oli Gillespie from the Amazon Profiler team for detecting the issue and providing a reproducer).

This fix should probably also be downported to jdk17 as quickly as possible.


Progress

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

Issue

  • JDK-8273902: Memory leak in OopStorage due to bug in OopHandle::release()

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5549

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 16, 2021

👋 Welcome back simonis! 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.

Loading

@openjdk openjdk bot added the rfr label Sep 16, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 16, 2021

@simonis The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

Loading

@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 16, 2021

Webrevs

Loading

Copy link
Contributor

@sspitsyn sspitsyn left a comment

Hi Volker,
Nice discovery!
LGTM
Thanks,
Serguei

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Sep 16, 2021

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

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

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

8273902: Memory leak in OopStorage due to bug in OopHandle::release()

Reviewed-by: sspitsyn, 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 7 new commits pushed to the master branch:

  • 9c5441c: 8271569: Clean up the use of CDS constants and field offsets
  • 12fa707: 8261941: Use ClassLoader for unregistered classes during -Xshare:dump
  • 7e92abe: 8273710: Remove redundant stream() call before forEach in jdk.jdeps
  • 59b2478: 8273659: Replay compilation crashes with SIGSEGV since 8271911
  • 5e4d09c: 8273300: Check Mutex ranking during a safepoint
  • c86e24d: 8271954: C2: assert(false) failed: Bad graph detected in build_loop_late
  • 14dc517: 8273372: Remove scavenge trace message in psPromotionManager

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

Loading

@openjdk openjdk bot added the ready label Sep 16, 2021
Copy link
Contributor

@coleenp coleenp left a comment

Yes, please backport. Thank you for fixing this.

Loading

@simonis
Copy link
Member Author

@simonis simonis commented Sep 16, 2021

@coleenp, @sspitsyn thanks for the quick review!

Loading

@simonis
Copy link
Member Author

@simonis simonis commented Sep 16, 2021

/integrate

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Sep 16, 2021

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

  • 9c5441c: 8271569: Clean up the use of CDS constants and field offsets
  • 12fa707: 8261941: Use ClassLoader for unregistered classes during -Xshare:dump
  • 7e92abe: 8273710: Remove redundant stream() call before forEach in jdk.jdeps
  • 59b2478: 8273659: Replay compilation crashes with SIGSEGV since 8271911
  • 5e4d09c: 8273300: Check Mutex ranking during a safepoint
  • c86e24d: 8271954: C2: assert(false) failed: Bad graph detected in build_loop_late
  • 14dc517: 8273372: Remove scavenge trace message in psPromotionManager

Your commit was automatically rebased without conflicts.

Loading

@openjdk openjdk bot closed this Sep 16, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Sep 16, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 16, 2021

@simonis Pushed as commit bc48a0a.

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

Loading

@simonis
Copy link
Member Author

@simonis simonis commented Sep 16, 2021

/backport jdk17u

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Sep 16, 2021

@simonis Unknown command backport - for a list of valid commands use /help.

Loading

@simonis
Copy link
Member Author

@simonis simonis commented Sep 16, 2021

/help

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Sep 16, 2021

@simonis Available commands:

  • covered - used when employer has signed the OCA
  • help - shows this text
  • signed - used after signing the OCA
  • test - used to run tests

Loading

@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 16, 2021

Mailing list message from David Holmes on hotspot-dev:

Hi Volker,

Please note that non-trivial fixes should wait ~24hrs before integration
to ensure a range of folk have an opportunity to comment.

Thanks,
David

On 17/09/2021 5:59 am, Volker Simonis wrote:

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants