Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8266404: Fatal error report generated with -XX:+CrashOnOutOfMemoryError should not contain suggestion to submit a bug report #4006

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -288,11 +288,15 @@ void report_vm_status_error(const char* file, int line, const char* error_msg,
report_vm_error(file, line, error_msg, "error %s(%d), %s", os::errno_name(status), status, detail);
}

void report_fatal(const char* file, int line, const char* detail_fmt, ...)
{
// Declaration for ATTRIBUTE_PRINTF application.
void report_fatal_impl(VMErrorType error_type, const char* file, int line,
const char* detail_fmt, va_list detail_args)
ATTRIBUTE_PRINTF(4,0);
dholmes-ora marked this conversation as resolved.
Show resolved Hide resolved

// Definition
void report_fatal_impl(VMErrorType error_type, const char* file, int line,
const char* detail_fmt, va_list detail_args) {
dholmes-ora marked this conversation as resolved.
Show resolved Hide resolved
if (Debugging || error_is_suppressed(file, line)) return;
va_list detail_args;
va_start(detail_args, detail_fmt);
void* context = NULL;
#ifdef CAN_SHOW_REGISTERS_ON_ASSERT
if (g_assertion_context != NULL && os::current_thread_id() == g_asserting_thread) {
@@ -302,7 +306,22 @@ void report_fatal(const char* file, int line, const char* detail_fmt, ...)

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

VMError::report_and_die(Thread::current_or_null(), context, file, line, "fatal error", detail_fmt, detail_args);
VMError::report_and_die(error_type, "fatal error", detail_fmt, detail_args,
Thread::current_or_null(), NULL, NULL, context,
file, line, 0);
}

void report_fatal(const char* file, int line, const char* detail_fmt, ...) {
va_list detail_args;
va_start(detail_args, detail_fmt);
report_fatal_impl(INTERNAL_ERROR, file, line, detail_fmt, detail_args);
va_end(detail_args);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this API? Can't we just update:

#define fatal(...)                                                                \
do {                                                                              \
  TOUCH_ASSERT_POISON;                                                            \
  report_fatal(INTERNAL_ERROR, __FILE__, __LINE__, __VA_ARGS__);                                  \
  BREAKPOINT;                                                                     \
} while (0)

Copy link
Member Author

@dholmes-ora dholmes-ora May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the fatal() macro seems to be the only user of the existing report_fatal then yes I think we can simplify this as you suggest. I had thought it was used directly from elsewhere.

Thanks for the suggestion.


void report_fatal(VMErrorType error_type, const char* file, int line, const char* detail_fmt, ...) {
va_list detail_args;
va_start(detail_args, detail_fmt);
report_fatal_impl(error_type, file, line, detail_fmt, detail_args);
va_end(detail_args);
}

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

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

if (ExitOnOutOfMemoryError) {
@@ -150,7 +150,8 @@ enum VMErrorType {
INTERNAL_ERROR = 0xe0000000,
OOM_MALLOC_ERROR = 0xe0000001,
OOM_MMAP_ERROR = 0xe0000002,
OOM_MPROTECT_ERROR = 0xe0000003
OOM_MPROTECT_ERROR = 0xe0000003,
OOM_JAVA_HEAP_FATAL = 0xe000004
dholmes-ora marked this conversation as resolved.
Show resolved Hide resolved
};

// Set to suppress secondary error reporting.
@@ -164,6 +165,7 @@ void report_vm_error(const char* file, int line, const char* error_msg,
void report_vm_status_error(const char* file, int line, const char* error_msg,
int status, const char* detail);
void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);
void report_fatal(VMErrorType error_type, const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5);
dholmes-ora marked this conversation as resolved.
Show resolved Hide resolved
void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type,
const char* detail_fmt, ...) ATTRIBUTE_PRINTF(5, 6);
void report_should_not_call(const char* file, int line);
@@ -636,7 +636,7 @@ void VMError::report(outputStream* st, bool _verbose) {

STEP("printing bug submit message")

if (should_report_bug(_id) && _verbose) {
if (should_submit_bug_report(_id) && _verbose) {
print_bug_submit_message(st, _thread);
}

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

static bool skip_bug_url = !should_report_bug(_id);
static bool skip_bug_url = !should_submit_bug_report(_id);
if (!skip_bug_url) {
skip_bug_url = true;

@@ -109,6 +109,10 @@ class VMError : public AllStatic {
return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR);
}

static bool should_submit_bug_report(unsigned int id) {
return should_report_bug(id) && (id != OOM_JAVA_HEAP_FATAL);
}

// Write a hint to the stream in case siginfo relates to a segv/bus error
// and the offending address points into CDS store.
static void check_failing_cds_access(outputStream* st, const void* siginfo);