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

8304147: JVM crash during shutdown when dumping dynamic archive #13134

Closed
wants to merge 13 commits into from

Conversation

dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Mar 22, 2023

DynamicArchive::prepare_for_dump_at_exit() could be called concurrently on the two VM exit paths, leading either to assertion failures in debug builds, or a crash in product build when the actual dump occurred. The basic fix was to move the DynamicArchive::prepare_for_dump_at_exit() functionality into before_exit (java.cpp) where it can only be executed by one thread - thus avoiding the race (Phase 1).

Once that is done we can move the actual dump operation to be co-located with the prepare_for_dump_at_exit() (Phase 2) and then consolidate that code by refactoring it into a new DynamicArchive::dump_at_exit() method (Phase 3), and then removing the leftover methods that are no longer needed (Phase 4).

Each phase can be seen in distinct commits if you prefer to see the steps involved.

Testing:

  • new ExitRace test
  • all dynamicArchive tests
  • tiers 1-4

Thanks.


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-8304147: JVM crash during shutdown when dumping dynamic archive

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13134

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 22, 2023

👋 Welcome back dholmes! 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 Mar 22, 2023

⚠️ @dholmes-ora This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk
Copy link

openjdk bot commented Mar 22, 2023

@dholmes-ora The following label will be automatically applied to this pull request:

  • hotspot

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.

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Mar 22, 2023
@dholmes-ora
Copy link
Member Author

/issue 8304147
/label add hotspot-runtime
/label remove hotspot

@openjdk openjdk bot changed the title 8304147 dynamic dump 8304147: JVM crash during shutdown when dumping dynamic archive Mar 22, 2023
@openjdk
Copy link

openjdk bot commented Mar 22, 2023

@dholmes-ora This issue is referenced in the PR title - it will now be updated.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Mar 22, 2023
@openjdk
Copy link

openjdk bot commented Mar 22, 2023

@dholmes-ora
The hotspot-runtime label was successfully added.

@openjdk openjdk bot removed the hotspot hotspot-dev@openjdk.org label Mar 22, 2023
@openjdk
Copy link

openjdk bot commented Mar 22, 2023

@dholmes-ora
The hotspot label was successfully removed.

@dholmes-ora dholmes-ora marked this pull request as ready for review March 22, 2023 05:22
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 22, 2023
@mlbridge
Copy link

mlbridge bot commented Mar 22, 2023

Webrevs

Copy link
Member

@calvinccheung calvinccheung left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this. I've couple of comments.

@dholmes-ora
Copy link
Member Author

Thanks for looking at this @calvinccheung !

Copy link
Member

@calvinccheung calvinccheung left a comment

Choose a reason for hiding this comment

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

Updates look good.

@openjdk
Copy link

openjdk bot commented Mar 22, 2023

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

8304147: JVM crash during shutdown when dumping dynamic archive

Reviewed-by: ccheung, matsaave, coleenp

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

  • 3b88b2a: 8304761: Update IANA Language Subtag Registry to Version 2023-03-22
  • f8e8fc7: 8177352: Calendar.getDisplayName(s) in non-lenient mode inconsistent, does not match spec
  • 14b970d: 8296656: java.lang.NoClassDefFoundError exception on running fully legitimate code
  • 80e2d52: 8302558: Editable JComboBox's popup blocks user from seeing characters in Aqua look and feel
  • 6c3b10f: 8303485: Replacing os.name for operating system customization
  • 87b314a: 7093691: Nimbus LAF: disabled JComboBox using renderer has bad font color
  • 2f34687: 8304689: Add hidden option to disable external spec page
  • 6b2f34f: 8304718: GetIntArrayElements should not be passed JNI_FALSE
  • 138cdc9: 8304694: Runtime exception thrown when break stmt is missing
  • 46b0602: 8304547: Remove checking of -Djava.compiler in src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java
  • ... and 52 more: https://git.openjdk.org/jdk/compare/c039d26603e85ae37b0a53430a47f5751bf911af...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 Mar 22, 2023
Copy link
Contributor

@matias9927 matias9927 left a comment

Choose a reason for hiding this comment

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

Consolidating some of the simpler methods is a good idea! LGTM

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

This is a very nice simplification of the JVM exit paths. I had a few minor comments.

src/hotspot/share/cds/dynamicArchive.cpp Outdated Show resolved Hide resolved
src/hotspot/share/cds/dynamicArchive.cpp Outdated Show resolved Hide resolved
src/hotspot/share/cds/dynamicArchive.cpp Outdated Show resolved Hide resolved
src/hotspot/share/cds/dynamicArchive.cpp Show resolved Hide resolved
@dholmes-ora
Copy link
Member Author

Thanks for the review @matias9927 !

@dholmes-ora
Copy link
Member Author

Thanks for the review @coleenp - all comments now addressed.

@dholmes-ora
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Mar 27, 2023

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

  • 554bccf: 8304448: Kitchensink failed: assert(!thread->is_in_any_VTMS_transition()) failed: class prepare events are not allowed in any VTMS transition
  • 3b88b2a: 8304761: Update IANA Language Subtag Registry to Version 2023-03-22
  • f8e8fc7: 8177352: Calendar.getDisplayName(s) in non-lenient mode inconsistent, does not match spec
  • 14b970d: 8296656: java.lang.NoClassDefFoundError exception on running fully legitimate code
  • 80e2d52: 8302558: Editable JComboBox's popup blocks user from seeing characters in Aqua look and feel
  • 6c3b10f: 8303485: Replacing os.name for operating system customization
  • 87b314a: 7093691: Nimbus LAF: disabled JComboBox using renderer has bad font color
  • 2f34687: 8304689: Add hidden option to disable external spec page
  • 6b2f34f: 8304718: GetIntArrayElements should not be passed JNI_FALSE
  • 138cdc9: 8304694: Runtime exception thrown when break stmt is missing
  • ... and 53 more: https://git.openjdk.org/jdk/compare/c039d26603e85ae37b0a53430a47f5751bf911af...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 27, 2023

@dholmes-ora Pushed as commit 63ce88b.

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

@dholmes-ora dholmes-ora deleted the 8304147-dynamic-dump branch March 27, 2023 22:05
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
4 participants