Skip to content

Commit cd1c17c

Browse files
author
David Holmes
committed
8266404: Fatal error report generated with -XX:+CrashOnOutOfMemoryError should not contain suggestion to submit a bug report
Reviewed-by: stuefe, kevinw, gziemski
1 parent 2effdd1 commit cd1c17c

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

src/hotspot/share/utilities/debug.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ void report_vm_status_error(const char* file, int line, const char* error_msg,
288288
report_vm_error(file, line, error_msg, "error %s(%d), %s", os::errno_name(status), status, detail);
289289
}
290290

291-
void report_fatal(const char* file, int line, const char* detail_fmt, ...)
292-
{
291+
void report_fatal(VMErrorType error_type, const char* file, int line, const char* detail_fmt, ...) {
293292
if (Debugging || error_is_suppressed(file, line)) return;
294293
va_list detail_args;
295294
va_start(detail_args, detail_fmt);
@@ -302,7 +301,9 @@ void report_fatal(const char* file, int line, const char* detail_fmt, ...)
302301

303302
print_error_for_unit_test("fatal error", detail_fmt, detail_args);
304303

305-
VMError::report_and_die(Thread::current_or_null(), context, file, line, "fatal error", detail_fmt, detail_args);
304+
VMError::report_and_die(error_type, "fatal error", detail_fmt, detail_args,
305+
Thread::current_or_null(), NULL, NULL, context,
306+
file, line, 0);
306307
va_end(detail_args);
307308
}
308309

@@ -360,7 +361,7 @@ void report_java_out_of_memory(const char* message) {
360361

361362
if (CrashOnOutOfMemoryError) {
362363
tty->print_cr("Aborting due to java.lang.OutOfMemoryError: %s", message);
363-
fatal("OutOfMemory encountered: %s", message);
364+
report_fatal(OOM_JAVA_HEAP_FATAL, __FILE__, __LINE__, "OutOfMemory encountered: %s", message);
364365
}
365366

366367
if (ExitOnOutOfMemoryError) {

src/hotspot/share/utilities/debug.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ do {
106106
#define fatal(...) \
107107
do { \
108108
TOUCH_ASSERT_POISON; \
109-
report_fatal(__FILE__, __LINE__, __VA_ARGS__); \
109+
report_fatal(INTERNAL_ERROR, __FILE__, __LINE__, __VA_ARGS__); \
110110
BREAKPOINT; \
111111
} while (0)
112112

@@ -150,7 +150,8 @@ enum VMErrorType {
150150
INTERNAL_ERROR = 0xe0000000,
151151
OOM_MALLOC_ERROR = 0xe0000001,
152152
OOM_MMAP_ERROR = 0xe0000002,
153-
OOM_MPROTECT_ERROR = 0xe0000003
153+
OOM_MPROTECT_ERROR = 0xe0000003,
154+
OOM_JAVA_HEAP_FATAL = 0xe0000004
154155
};
155156

156157
// Set to suppress secondary error reporting.
@@ -163,7 +164,7 @@ void report_vm_error(const char* file, int line, const char* error_msg,
163164
const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5);
164165
void report_vm_status_error(const char* file, int line, const char* error_msg,
165166
int status, const char* detail);
166-
void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);
167+
void report_fatal(VMErrorType error_type, const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5);
167168
void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type,
168169
const char* detail_fmt, ...) ATTRIBUTE_PRINTF(5, 6);
169170
void report_should_not_call(const char* file, int line);

src/hotspot/share/utilities/vmError.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ void VMError::report(outputStream* st, bool _verbose) {
636636

637637
STEP("printing bug submit message")
638638

639-
if (should_report_bug(_id) && _verbose) {
639+
if (should_submit_bug_report(_id) && _verbose) {
640640
print_bug_submit_message(st, _thread);
641641
}
642642

@@ -1584,7 +1584,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
15841584
}
15851585
}
15861586

1587-
static bool skip_bug_url = !should_report_bug(_id);
1587+
static bool skip_bug_url = !should_submit_bug_report(_id);
15881588
if (!skip_bug_url) {
15891589
skip_bug_url = true;
15901590

src/hotspot/share/utilities/vmError.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ class VMError : public AllStatic {
109109
return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR);
110110
}
111111

112+
static bool should_submit_bug_report(unsigned int id) {
113+
return should_report_bug(id) && (id != OOM_JAVA_HEAP_FATAL);
114+
}
115+
112116
// Write a hint to the stream in case siginfo relates to a segv/bus error
113117
// and the offending address points into CDS store.
114118
static void check_failing_cds_access(outputStream* st, const void* siginfo);

0 commit comments

Comments
 (0)