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

8258061: Improve diagnostic information about errors during class redefinition #1811

Closed
wants to merge 4 commits into from

Conversation

@lmesnik
Copy link
Member

@lmesnik lmesnik commented Dec 17, 2020

The error code during class redefinition might be not enough to easily diagnose the problem. Some more logging might be useful to understand it. I encountered this problem when redefined methods with lambda usage.
I run all existing tests with enabled logging and sanity verified error messages.


Progress

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

Issue

  • JDK-8258061: Improve diagnostic information about errors during class redefinition

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/1811/head:pull/1811
$ git checkout pull/1811

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Dec 17, 2020

👋 Welcome back lmesnik! 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 Dec 17, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Dec 17, 2020

@lmesnik 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 Dec 17, 2020

Webrevs

Loading

// access
old_flags = old_fs.access_flags().as_short();
new_flags = new_fs.access_flags().as_short();
if ((old_flags ^ new_flags) & JVM_RECOGNIZED_FIELD_MODIFIERS) {
return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED;
}
// offset
if (old_fs.offset() != new_fs.offset()) {
return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED;
}
Copy link
Contributor

@plummercj plummercj Dec 17, 2020

Choose a reason for hiding this comment

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

You've changed the ordering of the checks. I'm not sure why.

Loading

Copy link
Member Author

@lmesnik lmesnik Dec 17, 2020

Choose a reason for hiding this comment

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

I changed the order to report about different names first if any of the variables are added/deleted. And report about different modifiers/offsets only if the names of variables are the same.
The result should be the same because JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED is returned anyway.

Loading

@@ -932,6 +932,11 @@ jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions(
(the_class->super() == NULL || scratch_class->super() == NULL ||
the_class->super()->name() !=
scratch_class->super()->name())) {
log_trace(redefine, class, normalize)
("redefined class %s superclass change error: superclass changed from %s to %s.",
Copy link
Contributor

@plummercj plummercj Dec 17, 2020

Choose a reason for hiding this comment

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

I'm not so sure I like the style of the log message wording. I would prefer something like:

 error redefining class %s: superclass changed from %s to %s.

The same comment applies to pretty much every error message below. Besides being more concise and easier to read, I don't like using "superclass change error" when there is no such formally defined error. The error is JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED.

Loading

Copy link
Contributor

@plummercj plummercj Dec 17, 2020

Choose a reason for hiding this comment

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

I see now that you are just being consistent with the style used in existing logs, so I guess it's ok.

Loading

@@ -932,6 +932,11 @@ jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions(
(the_class->super() == NULL || scratch_class->super() == NULL ||
the_class->super()->name() !=
scratch_class->super()->name())) {
log_trace(redefine, class, normalize)
Copy link
Contributor

@coleenp coleenp Dec 17, 2020

Choose a reason for hiding this comment

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

I think these would be useful to users so that these should be made log_info(redefine). All the other redefinition logging is useful for developers in debugging redefinition, and a user wouldn't really be able to follow the output unless they are very knowledgeable. Making this log_info(redefine) would let them see this without the noise of the other output.

Loading

Copy link
Member Author

@lmesnik lmesnik Dec 17, 2020

Choose a reason for hiding this comment

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

I've made them log_trace to be consistent with already existing logging introduced for nestmates related errors. Do you want to make all of them log_info in such case?

Loading

Copy link
Contributor

@coleenp coleenp Dec 17, 2020

Choose a reason for hiding this comment

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

I see. I think so, yes. Since you're returning an error from redefinition, a higher level logging seems warranted.

Loading

Copy link
Member Author

@lmesnik lmesnik Dec 17, 2020

Choose a reason for hiding this comment

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

I've updated logging to use log_info where error is returned.

Loading

Copy link
Contributor

@coleenp coleenp left a comment

Looks good to me.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Dec 18, 2020

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

8258061: Improve diagnostic information about errors during class redefinition

Reviewed-by: coleenp, sspitsyn

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

  • 3f77a60: 8258582: HttpClient: the HttpClient doesn't explicitly shutdown its default executor when stopping.
  • f15528e: Merge
  • 30ca0a5: 8247994: Localize javadoc search
  • 47c180d: 8258515: javac should issue an error if an annotation is nested in a local class or interface
  • cb5a6b1: 8258225: compiler/c2/cr6340864/TestIntVect.java runs faster in interpreter
  • 61cbf0f: 8258293: tools/jpackage/share/RuntimePackageTest.java#id0 with RuntimePackageTest.testUsrInstallDir2
  • 7aac4dc: 8257621: JFR StringPool misses cached items across consecutive recordings
  • 61390d8: 8257999: Parallel GC crash in gc/parallel/TestDynShrinkHeap.java: new region is not in covered_region
  • 952dc70: 8257636: Update usage of "type" terminology in java.lang.Class and java.lang.reflect
  • 04a1e5b: 8258505: [TESTBUG] TestDivZeroWithSplitIf.java fails due to missing UnlockDiagnosticVMOptions
  • ... and 91 more: https://git.openjdk.java.net/jdk/compare/80dac5a87c63981a2588e29fe8127a6787abba47...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.

Loading

@openjdk openjdk bot added the ready label Dec 18, 2020
Copy link
Contributor

@sspitsyn sspitsyn left a comment

Hi Leonid,
It is useful and looks good.
Just one nit:
This line can be split after the comma:
1047 ("redefined class %s fields change error: some fields were %s.", the_class->external_name(), action);
Thanks,
Serguei

Loading

@lmesnik
Copy link
Member Author

@lmesnik lmesnik commented Dec 18, 2020

/integrate

Loading

@openjdk openjdk bot closed this Dec 18, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Dec 18, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Dec 18, 2020

@lmesnik Since your change was applied there have been 106 commits pushed to the master branch:

  • 68f2acb: 8252055: Use java.util.HexFormat in java.security
  • 1dae45d: 8250523: Remove abortOnException diagnostic option from TestHumongousNonArrayAllocation.java
  • 00d80fd: 8258255: Move PtrQueue active flag to SATBMarkQueue
  • 853c047: 8258469: Cleanup remaining safefetch test coding
  • 1e03ca1: 8258471: "search codecache" clhsdb command does not work
  • 3f77a60: 8258582: HttpClient: the HttpClient doesn't explicitly shutdown its default executor when stopping.
  • f15528e: Merge
  • 30ca0a5: 8247994: Localize javadoc search
  • 47c180d: 8258515: javac should issue an error if an annotation is nested in a local class or interface
  • cb5a6b1: 8258225: compiler/c2/cr6340864/TestIntVect.java runs faster in interpreter
  • ... and 96 more: https://git.openjdk.java.net/jdk/compare/80dac5a87c63981a2588e29fe8127a6787abba47...master

Your commit was automatically rebased without conflicts.

Pushed as commit 71ae05d.

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

Loading

@lmesnik lmesnik deleted the 8258061 branch Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants