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

8274944: AppCDS dump causes SEGV in VM thread while adjusting lambda proxy class info #6070

Conversation

calvinccheung
Copy link
Member

@calvinccheung calvinccheung commented Oct 21, 2021

During dumping of CDS archive, the ArchiveBuilder::gather_klass_and_symbol set the address of an object to null if the
object cannot be archived. Since the lambda proxy class in this scenario contains an old version (major version < 50) of
interface which has been linked, the class won't be archived and its address will be set to null. The SystemDictionaryShared::adjust_lambda_proxy_class_dictionary is called after
ArchiveBuilder::gather_klass_and_symbol and thus encountered the null pointer.

A fix is to add a function SystemDictionaryShared::cleanup_lambda_proxy_class_dictionary to cleanup the
_dumptime_lambda_proxy_class_dictionary at the beginning of the CDS dumping operation.

The proposed fix passed tiers 1 - 4 testing (including the new tests).


Progress

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

Issue

  • JDK-8274944: AppCDS dump causes SEGV in VM thread while adjusting lambda proxy class info

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6070/head:pull/6070
$ git checkout pull/6070

Update a local copy of the PR:
$ git checkout pull/6070
$ git pull https://git.openjdk.java.net/jdk pull/6070/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6070

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6070.diff

@calvinccheung
Copy link
Member Author

@calvinccheung calvinccheung commented Oct 21, 2021

/label add hotspot-runtime

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 21, 2021

👋 Welcome back ccheung! 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 openjdk bot added the hotspot-runtime label Oct 21, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Oct 21, 2021

@calvinccheung
The hotspot-runtime label was successfully added.

@calvinccheung calvinccheung marked this pull request as ready for review Oct 21, 2021
@openjdk openjdk bot added the rfr label Oct 21, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 21, 2021

Webrevs

yminqi
yminqi approved these changes Oct 22, 2021
Copy link
Contributor

@yminqi yminqi left a comment

LGTM.

@@ -1598,6 +1598,30 @@ void SystemDictionaryShared::restore_dumptime_tables() {
_cloned_dumptime_lambda_proxy_class_dictionary = NULL;
}

class CleanupDumpTimeLambdaProxyClassTable: StackObj {
public:
CleanupDumpTimeLambdaProxyClassTable() {}
Copy link
Contributor

@yminqi yminqi Oct 22, 2021

Choose a reason for hiding this comment

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

Why need a explicit public constructor for nothing?

Copy link
Member Author

@calvinccheung calvinccheung Oct 22, 2021

Choose a reason for hiding this comment

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

Thanks for your review.
In a previous version of the fix, the _dumptime_lambda_proxy_class_dictionary was passed to the constructor but it is no longer needed. I've removed the constructor.

@openjdk
Copy link

@openjdk openjdk bot commented Oct 22, 2021

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

8274944: AppCDS dump causes SEGV in VM thread while adjusting lambda proxy class info

Reviewed-by: minqi, 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 161 new commits pushed to the master branch:

  • 82f4aac: 8259609: C2: optimize long range checks in long counted loops
  • 574f890: 8275720: CommonComponentAccessibility.createWithParent isWrapped causes mem leak
  • 7c88a59: 8275809: crash in [CommonComponentAccessibility getCAccessible:withEnv:]
  • c9dec2f: 8273299: Unnecessary Vector usage in java.security.jgss
  • b98ed55: 8275819: [TableRowAccessibility accessibilityChildren] method is ineffective
  • 71d593e: 8275162: Use varargs in 'def' macros in mutexLocker.cpp
  • 7ca053d: 8251904: vmTestbase/nsk/sysdict/vm/stress/btree/btree010/btree010.java fails with ClassNotFoundException: nsk.sysdict.share.BTree0LLRLRLRRLR
  • 4be88d5: 8275047: Optimize existing fill stubs for AVX-512 target
  • 63e0f34: 8275767: JDK source code contains redundant boolean operations in jdk.charsets
  • 4961373: 8275137: jdk.unsupported/sun.reflect.ReflectionFactory.readObjectNoDataForSerialization uses wrong signature
  • ... and 151 more: https://git.openjdk.java.net/jdk/compare/d9e03e42afbb2e5115b67accfffad4938b8314b1...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 label Oct 22, 2021
@@ -512,6 +512,8 @@ char* VM_PopulateDumpSharedSpace::dump_read_only_tables() {
void VM_PopulateDumpSharedSpace::doit() {
HeapShared::run_full_gc_in_vm_thread();

SystemDictionaryShared::start_dumping();
Copy link
Member

@dholmes-ora dholmes-ora Oct 25, 2021

Choose a reason for hiding this comment

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

What is the significance of this? It seems unrelated to the bug being fixed.

Copy link
Member Author

@calvinccheung calvinccheung Oct 25, 2021

Choose a reason for hiding this comment

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

It is for setting the _dump_in_progress flag to true so that no new entries will be added to the _dumptime_table.
The SystemDictionaryShared::start_dumping() is being called for the dynamic dumping case, it would be consistent
if it is also called for the static dumping case.

Copy link
Member

@dholmes-ora dholmes-ora Oct 25, 2021

Choose a reason for hiding this comment

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

Perhaps but again that seems a different issue unrelated to this bug. Nor is it immediately obvious that the dynamic dumping and static dumping are equivalent in this regard. If the flag was only added for the dynamic case then apparently the static case does not need it - no?

Copy link
Member Author

@calvinccheung calvinccheung Oct 25, 2021

Choose a reason for hiding this comment

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

I've reverted the change of calling SystemDictionaryShared::start_dumping() for the static dump case.
If the call is needed, it will be addressed via a separate bug.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Seems fine.

Thanks,
David

yminqi
yminqi approved these changes Oct 26, 2021
Copy link
Contributor

@yminqi yminqi left a comment

Still LGTM.

@calvinccheung
Copy link
Member Author

@calvinccheung calvinccheung commented Oct 26, 2021

Thanks David and Yumin for the review.
/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Oct 26, 2021

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

  • 82f4aac: 8259609: C2: optimize long range checks in long counted loops
  • 574f890: 8275720: CommonComponentAccessibility.createWithParent isWrapped causes mem leak
  • 7c88a59: 8275809: crash in [CommonComponentAccessibility getCAccessible:withEnv:]
  • c9dec2f: 8273299: Unnecessary Vector usage in java.security.jgss
  • b98ed55: 8275819: [TableRowAccessibility accessibilityChildren] method is ineffective
  • 71d593e: 8275162: Use varargs in 'def' macros in mutexLocker.cpp
  • 7ca053d: 8251904: vmTestbase/nsk/sysdict/vm/stress/btree/btree010/btree010.java fails with ClassNotFoundException: nsk.sysdict.share.BTree0LLRLRLRRLR
  • 4be88d5: 8275047: Optimize existing fill stubs for AVX-512 target
  • 63e0f34: 8275767: JDK source code contains redundant boolean operations in jdk.charsets
  • 4961373: 8275137: jdk.unsupported/sun.reflect.ReflectionFactory.readObjectNoDataForSerialization uses wrong signature
  • ... and 151 more: https://git.openjdk.java.net/jdk/compare/d9e03e42afbb2e5115b67accfffad4938b8314b1...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Oct 26, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Oct 26, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Oct 26, 2021

@calvinccheung Pushed as commit e5cd269.

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

@calvinccheung calvinccheung deleted the 8274944-adjusting-lambda-proxy-classes branch Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime integrated
3 participants