mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 17:14:41 +02:00
8304147: JVM crash during shutdown when dumping dynamic archive
Reviewed-by: ccheung, matsaave, coleenp
This commit is contained in:
parent
554bccf046
commit
63ce88b5fb
7 changed files with 169 additions and 56 deletions
|
@ -439,6 +439,14 @@ void before_exit(JavaThread* thread, bool halt) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if INCLUDE_CDS
|
||||
// Dynamic CDS dumping must happen whilst we can still reliably
|
||||
// run Java code.
|
||||
DynamicArchive::dump_at_exit(thread, ArchiveClassesAtExit);
|
||||
assert(!thread->has_pending_exception(), "must be");
|
||||
#endif
|
||||
|
||||
|
||||
// Actual shutdown logic begins here.
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
|
@ -514,21 +522,6 @@ void before_exit(JavaThread* thread, bool halt) {
|
|||
// Note: we don't wait until it actually dies.
|
||||
os::terminate_signal_thread();
|
||||
|
||||
#if INCLUDE_CDS
|
||||
if (DynamicArchive::should_dump_at_vm_exit()) {
|
||||
assert(ArchiveClassesAtExit != nullptr, "Must be already set");
|
||||
ExceptionMark em(thread);
|
||||
DynamicArchive::dump(ArchiveClassesAtExit, thread);
|
||||
if (thread->has_pending_exception()) {
|
||||
ResourceMark rm(thread);
|
||||
oop pending_exception = thread->pending_exception();
|
||||
log_error(cds)("ArchiveClassesAtExit has failed %s: %s", pending_exception->klass()->external_name(),
|
||||
java_lang_String::as_utf8_string(java_lang_Throwable::message(pending_exception)));
|
||||
thread->clear_pending_exception();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
print_statistics();
|
||||
Universe::heap()->print_tracing_info();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue