From 7f4ed5001efac28f02fbbb78893051e28cc33e80 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Fri, 18 Oct 2024 05:55:07 +0000 Subject: [PATCH] 8341020: Error handler crashes when Metaspace is not fully initialized Reviewed-by: kbarrett, jsjolen, stefank, dholmes --- src/hotspot/share/runtime/os.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 8b1c52a5d33..5dc5a1af8cc 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1290,7 +1290,7 @@ void os::print_location(outputStream* st, intptr_t x, bool verbose) { } // Check if in metaspace and print types that have vptrs - if (Metaspace::contains(addr)) { + if (Metaspace::initialized() && Metaspace::contains(addr)) { if (Klass::is_valid((Klass*)addr)) { st->print_cr(INTPTR_FORMAT " is a pointer to class: ", p2i(addr)); ((Klass*)addr)->print_on(st);