Skip to content

JDK-8293156: Dcmd VM.classloaders fails to print the full hierarchy#10312

Closed
tstuefe wants to merge 5 commits intoopenjdk:masterfrom
tstuefe:JDK-8293156-Dcmd-VM.classloaders-fails-to-print-the-full-hierarchy
Closed

JDK-8293156: Dcmd VM.classloaders fails to print the full hierarchy#10312
tstuefe wants to merge 5 commits intoopenjdk:masterfrom
tstuefe:JDK-8293156-Dcmd-VM.classloaders-fails-to-print-the-full-hierarchy

Conversation

@tstuefe
Copy link
Member

@tstuefe tstuefe commented Sep 16, 2022

Fixes a bug in the VM.classloaders jcmd that causes class loaders to be omitted from the output if a parent class loader never loaded any class and therefore had no associated DCmd.

The fix changes the command to not rely on the existence of a CLD structure for the loader; instead, all information (loader class name, loader name, etc) is pulled via the loader oop, which has to be always there unless its the bootstrap loader.

Also, the tests were expanded to test the display of empty loaders and empty parent loaders.

Thanks to @dholmes-ora for finding this bug.


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-8293156: Dcmd VM.classloaders fails to print the full hierarchy

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10312

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 16, 2022

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

@openjdk
Copy link

openjdk bot commented Sep 16, 2022

@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 Sep 16, 2022
@tstuefe tstuefe marked this pull request as ready for review September 16, 2022 14:59
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 16, 2022
@mlbridge
Copy link

mlbridge bot commented Sep 16, 2022

Webrevs

Comment on lines 318 to 320
return (loader_klass() != NULL) && (loader_klass() == target_node->loader_klass()) &&
((loader_name_oop() == NULL && target_node->loader_name_oop() == NULL) ||
(::strcmp(loader_name(), target_node->loader_name()) == 0));
Copy link
Contributor

Choose a reason for hiding this comment

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

This is hard to parse. I think using if/else statements would be cleaner.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@tstuefe
Copy link
Member Author

tstuefe commented Sep 20, 2022

Hi @plummercj , thanks for your Review. I worked most of your your feedback.

.. Thomas

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.

Hi Thomas,

Generally this seems fine - but one issue below.

Thanks.

st->print(" \"%s\",", the_loader_name);
}
st->print(" %s", loader_klass != NULL ? loader_klass->external_name() : "??");
st->print(" %s", the_loader_class_name);
Copy link
Member

Choose a reason for hiding this comment

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

the_loader_class_name could be NULL here. You need to change loader_class_name() t return "??" like the original code uses.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. We never encounter this because Klass can only be null for the bootstrap loader, which is handled in a different branch. I'll fix it.

@tstuefe
Copy link
Member Author

tstuefe commented Sep 21, 2022

Hi @plummercj , thanks for your Review. I worked most of your your feedback.

.. Thomas

@tstuefe tstuefe closed this Sep 21, 2022
@tstuefe tstuefe reopened this Sep 21, 2022
@tstuefe
Copy link
Member Author

tstuefe commented Sep 21, 2022

  • Fixed all remaining occurrences of "childs"
  • Fixed possible segfault when printing class name for bootstrap loader
  • Fixed GHAs (apparently we don't have a MainWrapper class when executing jtreg in GHAs, so I cannot parse for it)

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.

Nothing further from me. Thanks!

@openjdk
Copy link

openjdk bot commented Sep 21, 2022

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

8293156: Dcmd VM.classloaders fails to print the full hierarchy

Reviewed-by: dholmes, cjplummer

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

  • e195897: 8294068: Unconditional and eager load of nio library since JDK-8264744
  • 84d7ff6: 8288129: Shenandoah: Skynet test crashed with iu + aggressive
  • 07afa3f: 8294110: compiler/uncommontrap/Decompile.java fails after JDK-8293798
  • 0746bcb: 8294083: RISC-V: Minimal build failed with --disable-precompiled-headers
  • 95ec2ea: 8293897: Synthetic final modifier is part of the AST for a try-with-resource resource
  • d14e96d: 8293493: Signal Handlers printout should show signal block state
  • da4fdfb: 8293659: Improve UnsatisfiedLinkError error message to include dlopen error details
  • cd1cdcd: 8293116: Incremental JDK build could be sped up
  • e9401e6: 8293364: IGV: Refactor Action in EditorTopComponent and fix minor bugs
  • 844a95b: 8292892: Javadoc index descriptions are not deterministic
  • ... and 81 more: https://git.openjdk.org/jdk/compare/7f3250d71c4866a64eb73f52140c669fe90f122f...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 Sep 21, 2022
@tstuefe
Copy link
Member Author

tstuefe commented Sep 21, 2022

Thanks @plummercj and @dholmes-ora .

/integrate

@openjdk
Copy link

openjdk bot commented Sep 21, 2022

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

  • 711e252: 8294039: Remove "Classpath" exception from java/awt tests
  • 27b8e2f: 8294038: Remove "Classpath" exception from javax/swing tests
  • e195897: 8294068: Unconditional and eager load of nio library since JDK-8264744
  • 84d7ff6: 8288129: Shenandoah: Skynet test crashed with iu + aggressive
  • 07afa3f: 8294110: compiler/uncommontrap/Decompile.java fails after JDK-8293798
  • 0746bcb: 8294083: RISC-V: Minimal build failed with --disable-precompiled-headers
  • 95ec2ea: 8293897: Synthetic final modifier is part of the AST for a try-with-resource resource
  • d14e96d: 8293493: Signal Handlers printout should show signal block state
  • da4fdfb: 8293659: Improve UnsatisfiedLinkError error message to include dlopen error details
  • cd1cdcd: 8293116: Incremental JDK build could be sped up
  • ... and 83 more: https://git.openjdk.org/jdk/compare/7f3250d71c4866a64eb73f52140c669fe90f122f...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 21, 2022

@tstuefe Pushed as commit c6be2cd.

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

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