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

8284532: Memory leak in BitSet::BitMapFragmentTable in JFR leak profiler #8148

Conversation

zhengyu123
Copy link
Contributor

@zhengyu123 zhengyu123 commented Apr 7, 2022

BitSet::BitMapFragmentTable needs a destructor to cleanup its contents to avoid leaking hashtable entries.


Progress

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

Issue

  • JDK-8284532: Memory leak in BitSet::BitMapFragmentTable in JFR leak profiler

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 8148

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 7, 2022

👋 Welcome back zgu! 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 openjdk bot added the rfr Pull request is ready for review label Apr 7, 2022
@openjdk
Copy link

openjdk bot commented Apr 7, 2022

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

  • hotspot-jfr

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 hotspot-jfr hotspot-jfr-dev@openjdk.org label Apr 7, 2022
@mlbridge
Copy link

mlbridge bot commented Apr 7, 2022

Webrevs

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

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

Hi Zhengyu,

small remark inline, otherwise this looks okay. This should really be a utility function in BasicHashMap.

What tests did you run?

Cheers, Thomas

Note that there is #7964 open too, but it may be easier to get this one in first to keep it easy to backport.

src/hotspot/share/jfr/leakprofiler/chains/bitset.cpp Outdated Show resolved Hide resolved
@zhengyu123
Copy link
Contributor Author

Hi Zhengyu,

small remark inline, otherwise this looks okay. This should really be a utility function in BasicHashMap.

Probably, I would like to defer it to separate CR, which it may touch quite a few places.

What tests did you run?

Manual test with JFR recording path-to-gc-roots=true, then run jcmd JFR.dump

Cheers, Thomas

Note that there is #7964 open too, but it may be easier to get this one in first to keep it easy to backport.

@tstuefe
Copy link
Member

tstuefe commented Apr 8, 2022

Hi Zhengyu,
small remark inline, otherwise this looks okay. This should really be a utility function in BasicHashMap.

Probably, I would like to defer it to separate CR, which it may touch quite a few places.

Sure. You just follow established patterns here.

What tests did you run?

Manual test with JFR recording path-to-gc-roots=true, then run jcmd JFR.dump

How did you notice the memory leak? In NMT dumps?

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

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

Looks good!

@openjdk
Copy link

openjdk bot commented Apr 8, 2022

@zhengyu123 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:

8284532: Memory leak in BitSet::BitMapFragmentTable in JFR leak profiler

Reviewed-by: stuefe, mgronlun, shade

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

  • 6028181: 8283930: IGV: add toggle button to show/hide empty blocks in CFG view
  • a445ecd: 8284297: Move FILE_AND_LINE to a platform independent header
  • 003aa2e: 8282043: IGV: speed up schedule approximation
  • 8c18705: 8284433: Cleanup Disassembler::find_prev_instr() on all platforms
  • e572a52: 8280511: AArch64: Combine shift and negate to a single instruction
  • de9596c: 8284495: [testbug] Adapt nsk tests to the RISC-V platform
  • d4a4884: 8284458: CodeHeapState::aggregate() leaks blob_name
  • e98c32d: 8284043: com/sun/jdi/MethodInvokeWithTraceOnTest.java failing with com.sun.jdi.ObjectCollectedException
  • 343e5f0: 8282040: Remove unnecessary check made obsolete by JDK-8261941
  • d6f01e9: 8234128: jarsigner will not show not-signed-by-alias warning if an intermediate cert is in this keystore
  • ... and 1 more: https://git.openjdk.java.net/jdk/compare/ec73c61d8fe5de15a42fc14aaf8ebe3ac9ffcae5...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.

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

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 8, 2022
Copy link

@mgronlun mgronlun left a comment

Choose a reason for hiding this comment

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

Looks good, thanks.

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Looks fine, modulo a bit of indenting.

Comment on lines 33 to 40
for (int index = 0; index < table_size(); index ++) {
Entry* e = bucket(index);
while (e != nullptr) {
Entry* tmp = e;
e = e->next();
free_entry(tmp);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I think indenting is a bit off here: should be 2 spaces at all columns. Probably a copy-paste--from-destructor error.

@zhengyu123
Copy link
Contributor Author

Thanks, @tstuefe @mgronlun @shipilev

@zhengyu123
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Apr 8, 2022

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

  • 8eac342: 8284507: GHA: Only check test results if testing was not skipped
  • 6028181: 8283930: IGV: add toggle button to show/hide empty blocks in CFG view
  • a445ecd: 8284297: Move FILE_AND_LINE to a platform independent header
  • 003aa2e: 8282043: IGV: speed up schedule approximation
  • 8c18705: 8284433: Cleanup Disassembler::find_prev_instr() on all platforms
  • e572a52: 8280511: AArch64: Combine shift and negate to a single instruction
  • de9596c: 8284495: [testbug] Adapt nsk tests to the RISC-V platform
  • d4a4884: 8284458: CodeHeapState::aggregate() leaks blob_name
  • e98c32d: 8284043: com/sun/jdi/MethodInvokeWithTraceOnTest.java failing with com.sun.jdi.ObjectCollectedException
  • 343e5f0: 8282040: Remove unnecessary check made obsolete by JDK-8261941
  • ... and 2 more: https://git.openjdk.java.net/jdk/compare/ec73c61d8fe5de15a42fc14aaf8ebe3ac9ffcae5...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 8, 2022
@openjdk openjdk bot closed this Apr 8, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 8, 2022
@openjdk
Copy link

openjdk bot commented Apr 8, 2022

@zhengyu123 Pushed as commit b55c32f.

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

@zhengyu123
Copy link
Contributor Author

Hi Zhengyu,
small remark inline, otherwise this looks okay. This should really be a utility function in BasicHashMap.

Probably, I would like to defer it to separate CR, which it may touch quite a few places.

Sure. You just follow established patterns here.

What tests did you run?

Manual test with JFR recording path-to-gc-roots=true, then run jcmd JFR.dump

How did you notice the memory leak? In NMT dumps?

Sorry, missed this comment earlier. No, I found it with valgrind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-jfr hotspot-jfr-dev@openjdk.org integrated Pull request has been integrated
4 participants