Skip to content

JDK-8302455: VM.classloader_stats memory size values are wrong #12556

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

Conversation

tstuefe
Copy link
Member

@tstuefe tstuefe commented Feb 14, 2023

VM.classloader_stats shows metaspace consumption in words, but should show bytes.

Patch fixes that, and adjusts the associated jtreg test to catch regressions like this.

I manually tested the test with the unpatched hotspot to see if the regression shows up, it does.

Tested the patch on x64 (fastdebug, release) and x86.

Note: "calculate_jfr_stats" is misnamed, actually only ever used by this dcmd, not by jfr. I will clear this up in a separate RFE.


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

Issue

  • JDK-8302455: VM.classloader_stats memory size values are wrong

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12556/head:pull/12556
$ git checkout pull/12556

Update a local copy of the PR:
$ git checkout pull/12556
$ git pull https://git.openjdk.org/jdk pull/12556/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12556

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12556.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 14, 2023

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

@tstuefe tstuefe force-pushed the JDK-8302455-VM.classloader_stats-memory-size-values-are-wrong branch from 21dca4a to 2be3a81 Compare February 14, 2023 13:42
@openjdk
Copy link

openjdk bot commented Feb 14, 2023

@tstuefe Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 14, 2023
@openjdk
Copy link

openjdk bot commented Feb 14, 2023

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

  • hotspot-runtime
  • 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.

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot-runtime hotspot-runtime-dev@openjdk.org labels Feb 14, 2023
@mlbridge
Copy link

mlbridge bot commented Feb 14, 2023

Webrevs

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.

Looks good.

@openjdk
Copy link

openjdk bot commented Feb 15, 2023

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

8302455: VM.classloader_stats memory size values are wrong

Reviewed-by: coleenp, dholmes

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

  • 3ba1560: 8302026: Port fdlibm inverse trig functions (asin, acos, atan) to Java
  • 861e302: 8302163: Speed up various String comparison methods with ArraysSupport.mismatch
  • 50dcc2a: 8301460: Clean up LambdaForm to reference BasicType enums directly
  • 28f5250: 8302127: Remove unused arg in write_ref_field_post
  • 0c96584: 8301225: Replace NULL with nullptr in share/gc/shenandoah/
  • 26b111d: 8301700: Increase the default TLS Diffie-Hellman group size from 1024-bit to 2048-bit
  • 5238817: 8301463: Code in DatagramSocket still refers to resolved JDK-8237352
  • 11194e8: 8302325: Wrong comment in java.base/share/native/libjimage/imageFile.hpp
  • 33bec20: 8300808: Accelerate Base64 on x86 for AVX2
  • 46bcc49: 8302147: Speed up compiler/jvmci/compilerToVM/IterateFramesNative.java
  • ... and 15 more: https://git.openjdk.org/jdk/compare/7dfe75cf553193faf709cff6b8b2505680d7cebc...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 Feb 15, 2023
@dholmes-ora
Copy link
Member

So in addition to the poor name, the declaration is wrong:

 void calculate_jfr_stats(size_t* p_used_bytes, size_t* p_capacity_bytes) const;

as it refers to bytes not words. Perhaps better to clean this up completely in this issue rather than a separate RFE?

@dholmes-ora
Copy link
Member

That said, given:

// This only exists for JFR and jcmd VM.classloader_stats. We may want to
//  change this. Capacity as a stat is of questionable use since it may
//  contain committed and uncommitted areas. For now we do this to maintain
//  backward compatibility with JFR.

and the fact this is not used by JFR then maybe it should all just be removed?

@tstuefe
Copy link
Member Author

tstuefe commented Feb 15, 2023

That said, given:

// This only exists for JFR and jcmd VM.classloader_stats. We may want to
//  change this. Capacity as a stat is of questionable use since it may
//  contain committed and uncommitted areas. For now we do this to maintain
//  backward compatibility with JFR.

and the fact this is not used by JFR then maybe it should all just be removed?

That's my plan, but I'd like to do this in a follow-up RFE. The patch I'd like to keep minimal for easy downport. I'd like to keep cleanups separate.

@dholmes-ora
Copy link
Member

Given the reason this bug likely arose is the fact the parameters to calculate_jfr_stats say they are "bytes" then fixing that is not a mere cleanup IMO. Can we at least fix that in this PR?

@tstuefe
Copy link
Member Author

tstuefe commented Feb 15, 2023

Given the reason this bug likely arose is the fact the parameters to calculate_jfr_stats say they are "bytes" then fixing that is not a mere cleanup IMO. Can we at least fix that in this PR?

Hi David, I reformed the ill-named function and renamed it to "usage_numbers", because that name and prototype is used in other places in Metaspace as well (e.g. MetaspaceArena), so its a uniform scheme.

Copy link
Member

@dholmes-ora dholmes-ora 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. The usage_numbers changes were a bit more involved then I had expected but they seem fine.

Thanks.

@tstuefe
Copy link
Member Author

tstuefe commented Feb 16, 2023

Thanks David!

/integrate

@openjdk
Copy link

openjdk bot commented Feb 16, 2023

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

  • 1480d41: 8208470: Type annotations on inner type that is an array component
  • 573c316: 8224980: FLAG_SET_ERGO silently ignores invalid values
  • 3ba1560: 8302026: Port fdlibm inverse trig functions (asin, acos, atan) to Java
  • 861e302: 8302163: Speed up various String comparison methods with ArraysSupport.mismatch
  • 50dcc2a: 8301460: Clean up LambdaForm to reference BasicType enums directly
  • 28f5250: 8302127: Remove unused arg in write_ref_field_post
  • 0c96584: 8301225: Replace NULL with nullptr in share/gc/shenandoah/
  • 26b111d: 8301700: Increase the default TLS Diffie-Hellman group size from 1024-bit to 2048-bit
  • 5238817: 8301463: Code in DatagramSocket still refers to resolved JDK-8237352
  • 11194e8: 8302325: Wrong comment in java.base/share/native/libjimage/imageFile.hpp
  • ... and 17 more: https://git.openjdk.org/jdk/compare/7dfe75cf553193faf709cff6b8b2505680d7cebc...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 16, 2023

@tstuefe Pushed as commit 6e2d3c6.

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

@tstuefe tstuefe deleted the JDK-8302455-VM.classloader_stats-memory-size-values-are-wrong branch April 5, 2023 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants