mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-22 09:19:37 +01:00
JBR-5722 vmTestbase/vm/gc/compact/Compact_TwoFields_InternedStrings: SIGSEGV at Symbol::as_klass_external_name(char*, int)
Do not use print_native_stack() when recording OOME stacks as it is designed to be used only in the context of a fatal error reporting where induced crashes are tolerated.
This commit is contained in:
@@ -47,6 +47,7 @@
|
|||||||
#include "utilities/growableArray.hpp"
|
#include "utilities/growableArray.hpp"
|
||||||
#include "utilities/macros.hpp"
|
#include "utilities/macros.hpp"
|
||||||
#include "utilities/ostream.hpp"
|
#include "utilities/ostream.hpp"
|
||||||
|
#include "utilities/vmError.hpp"
|
||||||
|
|
||||||
volatile size_t ClassLoaderDataGraph::_num_array_classes = 0;
|
volatile size_t ClassLoaderDataGraph::_num_array_classes = 0;
|
||||||
volatile size_t ClassLoaderDataGraph::_num_instance_classes = 0;
|
volatile size_t ClassLoaderDataGraph::_num_instance_classes = 0;
|
||||||
@@ -186,7 +187,8 @@ ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool has_class_mirror_
|
|||||||
inline void assert_is_safepoint_or_gc() {
|
inline void assert_is_safepoint_or_gc() {
|
||||||
assert(SafepointSynchronize::is_at_safepoint() ||
|
assert(SafepointSynchronize::is_at_safepoint() ||
|
||||||
Thread::current()->is_ConcurrentGC_thread() ||
|
Thread::current()->is_ConcurrentGC_thread() ||
|
||||||
Thread::current()->is_Worker_thread(),
|
Thread::current()->is_Worker_thread() ||
|
||||||
|
VMError::is_error_reported(), // don't crash here again if we have already crashed
|
||||||
"Must be called by safepoint or GC");
|
"Must be called by safepoint or GC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2197,28 +2197,25 @@ void VMError::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VMError::record_oome_stack(const char *message) {
|
void VMError::record_oome_stack(const char *message) {
|
||||||
MutexLocker ml(OOMEStacks_lock);
|
Thread * thread = Thread::current();
|
||||||
|
if (!thread->is_Java_thread()) {
|
||||||
|
// The following code can't work in non-Java thread.
|
||||||
|
// Besides, it's not a true OOM *exception* if there's no Java on the stack.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static char buf[O_BUFLEN];
|
{
|
||||||
address lastpc = nullptr;
|
MutexLocker ml(OOMEStacks_lock);
|
||||||
|
ResourceMark rm;
|
||||||
|
|
||||||
stringStream st(_oome_stacktrace[_oome_free_index], OOME_STACKTRACE_BUFSIZE);
|
stringStream st(_oome_stacktrace[_oome_free_index], OOME_STACKTRACE_BUFSIZE);
|
||||||
st.print_cr("OutOfMemoryError(\"%s\"):", message);
|
st.print_cr("OutOfMemoryError(\"%s\") on the thread \"%s\"", message, thread->name());
|
||||||
if (os::platform_print_native_stack(&st, _context, buf, sizeof(buf), lastpc)) {
|
JavaThread::cast(thread)->print_stack_on(&st);
|
||||||
// We have printed the native stack in platform-specific code
|
|
||||||
// Windows/x64 needs special handling.
|
|
||||||
} else {
|
|
||||||
print_native_stack(&st, os::current_frame(), Thread::current(), true, -1, buf, sizeof(buf));
|
|
||||||
_print_native_stack_used = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
st.cr();
|
st.cr();
|
||||||
|
|
||||||
if (Thread::current()->is_Java_thread()) {
|
|
||||||
print_stack_trace(&st, JavaThread::current(), buf, sizeof(buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
_oome_free_index = (_oome_free_index + 1) % OOME_STACKTRACE_COUNT;
|
_oome_free_index = (_oome_free_index + 1) % OOME_STACKTRACE_COUNT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VMError::print_oome_stacks(outputStream *st) {
|
void VMError::print_oome_stacks(outputStream *st) {
|
||||||
|
|||||||
Reference in New Issue
Block a user