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

8261019: [lworld] valhalla/valuetypes/QTypeDescriptorTest.java "Illegal class name "QLine;" in class file $Proxy5" #320

Closed
wants to merge 2 commits into from

Conversation

kelthuzadx
Copy link
Member

@kelthuzadx kelthuzadx commented Feb 4, 2021

Hi all,

QTypeDescriptorTest.java[0] also fails on my machine, this is occurred after merging JDK[1], I did some investigation. The root cause of the problem is that after the JDK was merged[1], the value of the constant CONSTANT_CLASS_DESCRIPTORS was changed from 61 to 62, but the major version of the class bytes generated dynamically by java.lang.reflect.ProxyGenerator was not updated simultaneously, it remained at the value 60:

private byte[] generateClassFile() {
  // V16 == 60
  visit(V16, accessFlags, dotToSlash(className), null,
          JLR_PROXY, typeNames(interfaces));
...
}

ClassFileParser::verify_legal_class_name would go to an unexpected branch, which causes ClassFormatError.

void ClassFileParser::verify_legal_class_name(...) const {
  ...
  if (length > 0) {
    ...
    // read _major_version(60) from dynamically generated class bytes,
    // compare with updated CONSTANT_CLASS_DESCRIPTORS(61)
    else if (_major_version >= CONSTANT_CLASS_DESCRIPTORS && bytes[length - 1] == ';' ) {
      // EXPECTED HERE
      legal = verify_unqualified_name(bytes + 1, length - 2, LegalClass);
    } else {
      // GO TO HERE
      legal = verify_unqualified_name(bytes, length, LegalClass);
    }
  }
  if (!legal) {
    ResourceMark rm(THREAD);
    assert(_class_name != NULL, "invariant");
    Exceptions::fthrow(
      THREAD_AND_LOCATION,
      vmSymbols::java_lang_ClassFormatError(),
      "Illegal class name \"%.*s\" in class file %s", length, bytes,
      _class_name->as_C_string()
    );
    return;
  }
}

JDK-826101 suspects that JDK-8261021[2] has the same problem since their exception messages are relatively similar. But according to their stack traces, they might be caused by different but related problems.

[0] https://bugs.openjdk.java.net/browse/JDK-8261019
[1] #316
[2] https://bugs.openjdk.java.net/browse/JDK-8261021


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8261019: [lworld] valhalla/valuetypes/QTypeDescriptorTest.java "Illegal class name "QLine;" in class file $Proxy5"

Reviewers

Download

$ git fetch https://git.openjdk.java.net/valhalla pull/320/head:pull/320
$ git checkout pull/320

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Feb 4, 2021

👋 Welcome back kelthuzadx! A progress list of the required criteria for merging this PR into lworld 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 label Feb 4, 2021
@kelthuzadx kelthuzadx changed the title 8261019: valhalla/valuetypes/QTypeDescriptorTest.java "Illegal class name "QLine;" in class file $Proxy5" 8261019: [lworld] valhalla/valuetypes/QTypeDescriptorTest.java "Illegal class name "QLine;" in class file $Proxy5" Feb 4, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Feb 4, 2021

Webrevs

@openjdk
Copy link

@openjdk openjdk bot commented Feb 4, 2021

⚠️ @kelthuzadx the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout valhalla_illegal_name
$ git commit -c user.name='Preferred Full Name' --allow-empty -m 'Update full name'
$ git push

@openjdk
Copy link

@openjdk openjdk bot commented Feb 4, 2021

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

8261019: [lworld] valhalla/valuetypes/QTypeDescriptorTest.java "Illegal class name "QLine;" in class file $Proxy5"

Reviewed-by: mchung

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 231 new commits pushed to the lworld branch:

  • 33dc4fb: Merge jdk
  • f025bc1: 8260301: misc gc/g1/unloading tests fails with "RuntimeException: Method could not be enqueued for compilation at level N"
  • 4a8b5c1: 8257858: [macOS]: Remove JNF dependency from libosxsecurity/KeystoreImpl.m
  • 472bf62: 8258799: [Testbug] RandomCommandsTest must check if tested directive is added via jcmd
  • b0ee7a8: 8241995: Clarify InetSocketAddress::toString specification
  • 0ef93fe: 8259265: Refactor UncaughtExceptions shell test as java test.
  • 5324b5c: 8260998: Shenandoah: Restore reference processing statistics reporting
  • c8de943: 8260617: Merge ZipFile encoding check with the initial hash calculation
  • ae2c5f0: 8260581: IGV: enhance node search
  • 9037615: 8222850: jshell tool: Misleading cascade compiler error in switch expression with undefined vars
  • ... and 221 more: https://git.openjdk.java.net/valhalla/compare/fbb8a6bdf878d2c370a0e78b04a5a5736f2eb765...lworld

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@mlchung) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready label Feb 4, 2021
mlchung
mlchung approved these changes Feb 4, 2021
Copy link
Member

@mlchung mlchung left a comment

Thanks for fixing it.

@@ -453,7 +453,7 @@ protected ClassLoader getClassLoader() {
* class file generation process.
*/
private byte[] generateClassFile() {
visit(V16, accessFlags, dotToSlash(className), null,
visit(V17, accessFlags, dotToSlash(className), null,
Copy link
Member

@mlchung mlchung Feb 4, 2021

Choose a reason for hiding this comment

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

Alternatively, we can use the value of the system property java.class.version to prepare for future class file version change. But this requires parsing it to extract the major version.

I'm okay with this simple approach and remember to update it if the class file version is bumped.

Copy link
Member Author

@kelthuzadx kelthuzadx Feb 5, 2021

Choose a reason for hiding this comment

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

It seems reasonable. When I fix another related fail, I can tweak this part.

@kelthuzadx
Copy link
Member Author

@kelthuzadx kelthuzadx commented Feb 5, 2021

/integrate

@openjdk openjdk bot added the sponsor label Feb 5, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Feb 5, 2021

@kelthuzadx
Your change (at version 04836bb) is now ready to be sponsored by a Committer.

@hseigel
Copy link
Member

@hseigel hseigel commented Feb 5, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Feb 5, 2021

@hseigel Only the author (@kelthuzadx) is allowed to issue the integrate command. As this PR is ready to be sponsored, and you are an eligible sponsor, did you mean to issue the /sponsor command?

@hseigel
Copy link
Member

@hseigel hseigel commented Feb 5, 2021

/sponsor

@openjdk openjdk bot closed this Feb 5, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Feb 5, 2021

@hseigel @kelthuzadx Since your change was applied there have been 235 commits pushed to the lworld branch:

  • c4f63d2: 8261264: [lworld] runtime/valhalla/inlinetypes tests fail to compile
  • 5f1e8d9: 8260606: Update Valhalla core-libs naming for methods related to primitive classes
  • ddfba61: 8261226: [lworld] Array access profiling should be disabled at compilation level 1 and 2
  • ce486c3: 8261037: [lworld] Assert during C2 compilation due to inconsistent JVMState at safepoint
  • 33dc4fb: Merge jdk
  • f025bc1: 8260301: misc gc/g1/unloading tests fails with "RuntimeException: Method could not be enqueued for compilation at level N"
  • 4a8b5c1: 8257858: [macOS]: Remove JNF dependency from libosxsecurity/KeystoreImpl.m
  • 472bf62: 8258799: [Testbug] RandomCommandsTest must check if tested directive is added via jcmd
  • b0ee7a8: 8241995: Clarify InetSocketAddress::toString specification
  • 0ef93fe: 8259265: Refactor UncaughtExceptions shell test as java test.
  • ... and 225 more: https://git.openjdk.java.net/valhalla/compare/fbb8a6bdf878d2c370a0e78b04a5a5736f2eb765...lworld

Your commit was automatically rebased without conflicts.

Pushed as commit 4768ea2.

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

@kelthuzadx kelthuzadx deleted the valhalla_illegal_name branch Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants