mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8372380: Make hs_err reporting more robust for unattached threads
Reviewed-by: shade, aboldtch, kevinw
This commit is contained in:
parent
c028369dcb
commit
6e920fbdab
@ -1010,8 +1010,10 @@ void CompilationMemoryStatistic::print_error_report(outputStream* st) {
|
||||
oom_stats->print_peak_state_on(st);
|
||||
st->cr();
|
||||
}
|
||||
st->print_cr("Compiler Memory Statistic, 10 most expensive compilations:");
|
||||
print_all_by_size(st, false, false, 0, 10);
|
||||
if (Thread::current_or_null_safe() != nullptr) {
|
||||
st->print_cr("Compiler Memory Statistic, 10 most expensive compilations:");
|
||||
print_all_by_size(st, false, false, 0, 10);
|
||||
}
|
||||
}
|
||||
|
||||
void CompilationMemoryStatistic::print_final_report(outputStream* st) {
|
||||
|
||||
@ -2355,7 +2355,8 @@ static void print_region_type(outputStream* st, const char* type, uint count, bo
|
||||
}
|
||||
|
||||
void G1CollectedHeap::print_heap_on(outputStream* st) const {
|
||||
size_t heap_used = Heap_lock->owned_by_self() ? used() : used_unlocked();
|
||||
size_t heap_used = (Thread::current_or_null_safe() != nullptr &&
|
||||
Heap_lock->owned_by_self()) ? used() : used_unlocked();
|
||||
st->print("%-20s", "garbage-first heap");
|
||||
st->print(" total reserved %zuK, committed %zuK, used %zuK",
|
||||
_hrm.reserved().byte_size()/K, capacity()/K, heap_used/K);
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "runtime/mutex.hpp"
|
||||
#include "runtime/mutexLocker.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/thread.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
|
||||
stringStream* GCLogPrecious::_lines = nullptr;
|
||||
@ -83,7 +84,8 @@ void GCLogPrecious::print_on_error(outputStream* st) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_lock->try_lock_without_rank_check()) {
|
||||
if (Thread::current_or_null_safe() == nullptr ||
|
||||
!_lock->try_lock_without_rank_check()) {
|
||||
st->print_cr("<Skipped>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -664,6 +664,7 @@ void VMError::report(outputStream* st, bool _verbose) {
|
||||
BEGIN
|
||||
if (MemTracker::enabled() &&
|
||||
NmtVirtualMemory_lock != nullptr &&
|
||||
_thread != nullptr &&
|
||||
NmtVirtualMemory_lock->owned_by_self()) {
|
||||
// Manually unlock to avoid reentrancy due to mallocs in detailed mode.
|
||||
NmtVirtualMemory_lock->unlock();
|
||||
@ -1305,7 +1306,7 @@ void VMError::report(outputStream* st, bool _verbose) {
|
||||
os::print_signal_handlers(st, buf, sizeof(buf));
|
||||
st->cr();
|
||||
|
||||
STEP_IF("Native Memory Tracking", _verbose)
|
||||
STEP_IF("Native Memory Tracking", _verbose && _thread != nullptr)
|
||||
MemTracker::error_report(st);
|
||||
st->cr();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user