-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8359120: Improve warning message when fail to load hsdis library #25726
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back tkurashige! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@kurashige23 The following label will be automatically applied to this pull request:
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. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this. I have been confused by this myself and think this is a great improvement. I do have a few comments and questions, though.
Currently, I do not understand exactly how your new message is only printed when hsdis is not loaded. Do we only emit a MachCode section if hsdis is not loaded?
} else { | ||
log_warning(os)("Loading hsdis library failed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I would leave this warning. It does not hurt, and perhaps someone is depending on it to detect if hsdis is installed correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought your comment made sense.
I fixed it.
src/hotspot/share/code/nmethod.cpp
Outdated
@@ -3488,6 +3488,9 @@ void nmethod::decode2(outputStream* ost) const { | |||
if (use_compressed_format && ! compressed_with_comments) { | |||
const_cast<nmethod*>(this)->print_constant_pool(st); | |||
|
|||
st->bol(); | |||
st->cr(); | |||
st->print_cr("Loading hsdis library failed, so undisassembled code is printed in the below [MachCode] section"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments on the message:
- I don't think we should use
[MachCode]
inside the square brackets apart from marking the start of a section. Otherwise, tools parsing a hs_err file incorrectly identify the start of the MachCode section. - Personally, I find the language of the message a bit clunky. Here are a few suggestions I would personally prefer:
Loading hsdis library failed, unable to show disassembled code in MachCode section
orNote: Unable to display disassembled code because loading of hsdis library failed.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should use [MachCode]
You're right. I will stop using [MachCode]
.
Here are a few suggestions I would personally prefer:
Thank you for your suggestion.
I prefer the former expression.
However, if hsdis is loaded successfully, the disassembled code will appear in [Disassembly]
instead of [MachCode]
, so I don't think "unable to show disassembled code in MachCode section" is appropriate.
Do you think "undisassembled" is clunky? "undisassembled" is also used in src/hotspot/share/code/nmethod.cpp#L3428, so I don't think it's too clunky.
So, for example, how about Loading hsdis library failed, undisassembled code is shown in MachCode section
? If "undisassembled" is clunky, I think it could be "not disassembled" for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do happen to dislike "undisassembled", but I was not aware of its usage in other places in the codebase. I'm fine with the message now.
Thank you for your comment! Yes, my research shows that we only emit a MachCode section if hsdis is not loaded.
static bool is_abstract() {
if (!_tried_to_load_library) {
load_library();
}
return ! _library_usable;
} There are three direct processes to output the MachCode section:
1. is called when For example, if loading hsdis fails to load and hs_err occurs 2. is called when For example, if only 3. is called when For example, |
Thank you for addressing my comments and for your explanation! The changes look good to me, but nonetheless I kicked off some testing on our side and I'll get back to you with the results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing passed. Looks good to me!
Thank you for your review. I think I need approval from 1 reviewer, could you introduce someone? Thanks. |
Don't we already have such error reporting code in
|
This PR is improvement of warning message when fail to load hsdis library.
JDK-8287001 introduced a warning on hsdis library load failure. This is useful when the user executes -XX:+PrintAssembly, etc.
However, I think that when hs_err occurs, users might be confused by this warning printed by Xlog. Because users are not likely to know that hsdis is loaded for the [MachCode] section of the hs_err report, they may wonder, for example, "Why do I get warnings about hsdis load errors when -XX:+PrintAssembly is not specified?."
To clear up this confusion, I suggest printing a warning just before [MachCode].
sample output
If hs_err occurs and hsdis load fails without the option to specify where the hs_err report should be output, the following is output to the hs_err_pir log file:
If -XX:+PrintAssembly is specified and hsdis load fails, the following is output to the stdout
Since the warning added in this fix cover the role of warning introduced in JDK-8287001, I removed lines added in JDK-8287001 and JDK-8289421.
Testing:
・test/hotspot/jtreg/runtime/ErrorHandling on Windows Server 2019 (Some tests use fatdebug version, so I ran with fatdebug version)
・tested on Windows Server 2019 that each print_cr() in 3 routes prints warning just before [MachCode] and that JDK-8287001's warning isn't printed
・GHA testing
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25726/head:pull/25726
$ git checkout pull/25726
Update a local copy of the PR:
$ git checkout pull/25726
$ git pull https://git.openjdk.org/jdk.git pull/25726/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25726
View PR using the GUI difftool:
$ git pr show -t 25726
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25726.diff
Using Webrev
Link to Webrev Comment