RFR: 8304147: JVM crash during shutdown when dumping dynamic archive
David Holmes
dholmes at openjdk.org
Wed Mar 22 05:31:47 UTC 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.
-------------
Commit messages:
- Update test comments
- Phase 4: remove unused methods and adjust dump_for_jcmd
- Missed removing the check at the dump_at_exit callsite.
- Phase 3: Consolidate code into a new dump_at_exit that combines check, prepare and dump in one.
- Merge branch '8304147-test-only' into 8304147-dynamic-dump
- Initial test
- Phase 2: Move the dump to immediately after the prepare_for_dump
- Phase 1: Relocate DynamicArchive::prepare_for_dump_at_exit to before_exit.
- Add logging for dump prepation
Changes: https://git.openjdk.org/jdk/pull/13134/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13134&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8304147
Stats: 209 lines in 7 files changed: 156 ins; 41 del; 12 mod
Patch: https://git.openjdk.org/jdk/pull/13134.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13134/head:pull/13134
PR: https://git.openjdk.org/jdk/pull/13134
More information about the hotspot-runtime-dev
mailing list