Skip to content

Commit 71f793e

Browse files
committed
8266404: Fatal error report generated with -XX:+CrashOnOutOfMemoryError should not contain suggestion to submit a bug report
Reviewed-by: clanger Backport-of: cd1c17c
1 parent e56abca commit 71f793e

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

src/hotspot/share/utilities/debug.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -254,8 +254,7 @@ void report_vm_status_error(const char* file, int line, const char* error_msg,
254254
report_vm_error(file, line, error_msg, "error %s(%d), %s", os::errno_name(status), status, detail);
255255
}
256256

257-
void report_fatal(const char* file, int line, const char* detail_fmt, ...)
258-
{
257+
void report_fatal(VMErrorType error_type, const char* file, int line, const char* detail_fmt, ...) {
259258
if (Debugging || error_is_suppressed(file, line)) return;
260259
va_list detail_args;
261260
va_start(detail_args, detail_fmt);
@@ -265,7 +264,9 @@ void report_fatal(const char* file, int line, const char* detail_fmt, ...)
265264
context = g_assertion_context;
266265
}
267266
#endif // CAN_SHOW_REGISTERS_ON_ASSERT
268-
VMError::report_and_die(Thread::current_or_null(), context, file, line, "fatal error", detail_fmt, detail_args);
267+
VMError::report_and_die(error_type, "fatal error", detail_fmt, detail_args,
268+
Thread::current_or_null(), NULL, NULL, context,
269+
file, line, 0);
269270
va_end(detail_args);
270271
}
271272

@@ -335,7 +336,7 @@ void report_java_out_of_memory(const char* message) {
335336

336337
if (CrashOnOutOfMemoryError) {
337338
tty->print_cr("Aborting due to java.lang.OutOfMemoryError: %s", message);
338-
fatal("OutOfMemory encountered: %s", message);
339+
report_fatal(OOM_JAVA_HEAP_FATAL, __FILE__, __LINE__, "OutOfMemory encountered: %s", message);
339340
}
340341

341342
if (ExitOnOutOfMemoryError) {
@@ -770,4 +771,3 @@ bool handle_assert_poison_fault(const void* ucVoid, const void* faulting_address
770771
return false;
771772
}
772773
#endif // CAN_SHOW_REGISTERS_ON_ASSERT
773-

src/hotspot/share/utilities/debug.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -109,7 +109,7 @@ do {
109109
#define fatal(...) \
110110
do { \
111111
TOUCH_ASSERT_POISON; \
112-
report_fatal(__FILE__, __LINE__, __VA_ARGS__); \
112+
report_fatal(INTERNAL_ERROR, __FILE__, __LINE__, __VA_ARGS__); \
113113
BREAKPOINT; \
114114
} while (0)
115115

@@ -152,7 +152,9 @@ do {
152152
enum VMErrorType {
153153
INTERNAL_ERROR = 0xe0000000,
154154
OOM_MALLOC_ERROR = 0xe0000001,
155-
OOM_MMAP_ERROR = 0xe0000002
155+
OOM_MMAP_ERROR = 0xe0000002,
156+
OOM_MPROTECT_ERROR = 0xe0000003,
157+
OOM_JAVA_HEAP_FATAL = 0xe0000004
156158
};
157159

158160
// error reporting helper functions
@@ -174,7 +176,7 @@ void report_assert_msg(const char* msg, ...);
174176
#endif
175177
void report_vm_status_error(const char* file, int line, const char* error_msg,
176178
int status, const char* detail);
177-
void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);
179+
void report_fatal(VMErrorType error_type, const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5);
178180
void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type,
179181
const char* detail_fmt, ...) ATTRIBUTE_PRINTF(5, 6);
180182
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
@@ -604,7 +604,7 @@ void VMError::report(outputStream* st, bool _verbose) {
604604

605605
STEP("printing bug submit message")
606606

607-
if (should_report_bug(_id) && _verbose) {
607+
if (should_submit_bug_report(_id) && _verbose) {
608608
print_bug_submit_message(st, _thread);
609609
}
610610

@@ -1555,7 +1555,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
15551555
}
15561556
}
15571557

1558-
static bool skip_bug_url = !should_report_bug(_id);
1558+
static bool skip_bug_url = !should_submit_bug_report(_id);
15591559
if (!skip_bug_url) {
15601560
skip_bug_url = true;
15611561

src/hotspot/share/utilities/vmError.hpp

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

117+
static bool should_submit_bug_report(unsigned int id) {
118+
return should_report_bug(id) && (id != OOM_JAVA_HEAP_FATAL);
119+
}
120+
117121
// Write a hint to the stream in case siginfo relates to a segv/bus error
118122
// and the offending address points into CDS store.
119123
static void check_failing_cds_access(outputStream* st, const void* siginfo);

0 commit comments

Comments
 (0)