From f1d76fa92501e45f25a7d33d8c5eee7ef60973eb Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Wed, 15 Feb 2023 00:44:02 +0000 Subject: [PATCH] 8302262: Remove -XX:SuppressErrorAt develop option Reviewed-by: stuefe, dholmes, tschatzl --- src/hotspot/share/runtime/globals.hpp | 3 - src/hotspot/share/runtime/vframe.cpp | 3 +- src/hotspot/share/utilities/debug.cpp | 109 +----------------- .../ShowRegistersOnAssertTest.java | 31 ++--- .../TestCrashOnOutOfMemoryError.java | 5 +- .../nsk/stress/strace/strace003.java | 47 +------- .../nsk/stress/strace/strace004.java | 39 +------ .../test/whitebox/vm_flags/StringTest.java | 6 +- 8 files changed, 19 insertions(+), 224 deletions(-) diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 32cec61962d..13885794a9c 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -1311,9 +1311,6 @@ const int ObjectAlignmentInBytes = 8; develop(intx, MallocCatchPtr, -1, \ "Hit breakpoint when mallocing/freeing this pointer") \ \ - notproduct(ccstrlist, SuppressErrorAt, "", \ - "List of assertions (file:line) to muzzle") \ - \ develop(intx, StackPrintLimit, 100, \ "number of stack frames to print in VM-level stack dump") \ \ diff --git a/src/hotspot/share/runtime/vframe.cpp b/src/hotspot/share/runtime/vframe.cpp index 5e69cd230ba..2dc2d5a9281 100644 --- a/src/hotspot/share/runtime/vframe.cpp +++ b/src/hotspot/share/runtime/vframe.cpp @@ -482,8 +482,7 @@ MonitorInfo::MonitorInfo(oop owner, BasicLock* lock, bool eliminated, bool owner void vframeStreamCommon::found_bad_method_frame() const { // 6379830 Cut point for an assertion that occasionally fires when // we are using the performance analyzer. - // Disable this assert when testing the analyzer with fastdebug. - // -XX:SuppressErrorAt=vframe.cpp:XXX (XXX=following line number) + // Disable this when testing the analyzer with fastdebug. fatal("invalid bci or invalid scope desc"); } #endif diff --git a/src/hotspot/share/utilities/debug.cpp b/src/hotspot/share/utilities/debug.cpp index d33387c2ad8..afa472cf0de 100644 --- a/src/hotspot/share/utilities/debug.cpp +++ b/src/hotspot/share/utilities/debug.cpp @@ -131,111 +131,6 @@ void warning(const char* format, ...) { } } -#ifndef PRODUCT - -#define is_token_break(ch) (isspace(ch) || (ch) == ',') - -static const char* last_file_name = nullptr; -static int last_line_no = -1; - -// assert/guarantee/... may happen very early during VM initialization. -// Don't rely on anything that is initialized by Threads::create_vm(). For -// example, don't use tty. -bool error_is_suppressed(const char* file_name, int line_no) { - // The following 1-element cache requires that passed-in - // file names are always only constant literals. - if (file_name == last_file_name && line_no == last_line_no) return true; - - int file_name_len = (int)strlen(file_name); - char separator = os::file_separator()[0]; - const char* base_name = strrchr(file_name, separator); - if (base_name == nullptr) - base_name = file_name; - - // scan the SuppressErrorAt option - const char* cp = SuppressErrorAt; - for (;;) { - const char* sfile; - int sfile_len; - int sline; - bool noisy; - while ((*cp) != '\0' && is_token_break(*cp)) cp++; - if ((*cp) == '\0') break; - sfile = cp; - while ((*cp) != '\0' && !is_token_break(*cp) && (*cp) != ':') cp++; - sfile_len = cp - sfile; - if ((*cp) == ':') cp++; - sline = 0; - while ((*cp) != '\0' && isdigit(*cp)) { - sline *= 10; - sline += (*cp) - '0'; - cp++; - } - // "file:line!" means the assert suppression is not silent - noisy = ((*cp) == '!'); - while ((*cp) != '\0' && !is_token_break(*cp)) cp++; - // match the line - if (sline != 0) { - if (sline != line_no) continue; - } - // match the file - if (sfile_len > 0) { - const char* look = file_name; - const char* look_max = file_name + file_name_len - sfile_len; - const char* foundp; - bool match = false; - while (!match - && (foundp = strchr(look, sfile[0])) != nullptr - && foundp <= look_max) { - match = true; - for (int i = 1; i < sfile_len; i++) { - if (sfile[i] != foundp[i]) { - match = false; - break; - } - } - look = foundp + 1; - } - if (!match) continue; - } - // got a match! - if (noisy) { - fdStream out(defaultStream::output_fd()); - out.print_raw("[error suppressed at "); - out.print_raw(base_name); - char buf[16]; - jio_snprintf(buf, sizeof(buf), ":%d]", line_no); - out.print_raw_cr(buf); - } else { - // update 1-element cache for fast silent matches - last_file_name = file_name; - last_line_no = line_no; - } - return true; - } - - if (!VMError::is_error_reported() && !SuppressFatalErrorMessage) { - // print a friendly hint: - fdStream out(defaultStream::output_fd()); - out.print_raw_cr("# To suppress the following error report, specify this argument"); - out.print_raw ("# after -XX: or in .hotspotrc: SuppressErrorAt="); - out.print_raw (base_name); - char buf[16]; - jio_snprintf(buf, sizeof(buf), ":%d", line_no); - out.print_raw_cr(buf); - } - return false; -} - -#undef is_token_break - -#else - -// Place-holder for non-existent suppression check: -#define error_is_suppressed(file_name, line_no) (false) - -#endif // !PRODUCT - void report_vm_error(const char* file, int line, const char* error_msg) { report_vm_error(file, line, error_msg, "%s", ""); @@ -271,7 +166,7 @@ static void print_error_for_unit_test(const char* message, const char* detail_fm void report_vm_error(const char* file, int line, const char* error_msg, const char* detail_fmt, ...) { - if (Debugging || error_is_suppressed(file, line)) return; + if (Debugging) return; va_list detail_args; va_start(detail_args, detail_fmt); void* context = nullptr; @@ -293,7 +188,7 @@ void report_vm_status_error(const char* file, int line, const char* error_msg, } void report_fatal(VMErrorType error_type, const char* file, int line, const char* detail_fmt, ...) { - if (Debugging || error_is_suppressed(file, line)) return; + if (Debugging) return; va_list detail_args; va_start(detail_args, detail_fmt); void* context = nullptr; diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java index 7f967a0a74d..b5ce0952ff6 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2018, 2022 SAP SE. All rights reserved. - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,43 +50,32 @@ import jdk.test.lib.process.ProcessTools; public class ShowRegistersOnAssertTest { private static void do_test(boolean do_assert, // true - assert, false - guarantee - boolean suppress_assert, boolean show_registers_on_assert) throws Exception { - System.out.println("Testing " + (suppress_assert ? "suppressed" : "normal") + " " + (do_assert ? "assert" : "guarantee") + + System.out.println("Testing " + (do_assert ? "assert" : "guarantee") + " with " + (show_registers_on_assert ? "-XX:+ShowRegistersOnAssert" : "-XX:-ShowRegistersOnAssert") + "..."); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:-CreateCoredumpOnCrash", "-XX:ErrorHandlerTest=" + (do_assert ? "1" : "2"), - (suppress_assert ? "-XX:SuppressErrorAt=/vmError.cpp" : ""), (show_registers_on_assert ? "-XX:+ShowRegistersOnAssert" : "-XX:-ShowRegistersOnAssert"), "-version"); OutputAnalyzer output_detail = new OutputAnalyzer(pb.start()); - if (suppress_assert) { - // we should have not have crashed. See VMError::controlled_crash(). - output_detail.shouldMatch(".*survived intentional crash.*"); - } else { - // we should have crashed with an internal error. We should definitly NOT have crashed with a segfault - // (which would be a sign that the assert poison page mechanism does not work). - output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*"); - output_detail.shouldMatch("# +Internal Error.*"); - } + // we should have crashed with an internal error. We should definitly NOT have crashed with a segfault + // (which would be a sign that the assert poison page mechanism does not work). + output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*"); + output_detail.shouldMatch("# +Internal Error.*"); } public static void main(String[] args) throws Exception { // Note: for now, this is only a regression test testing that the addition of ShowRegistersOnAssert does // not break normal assert/guarantee handling. The feature is not implemented on all platforms and really testing // it requires more effort. - do_test(false, false, false); - do_test(false, false, true); - do_test(false, true, false); - do_test(false, true, true); - do_test(true, false, false); - do_test(true, false, true); - do_test(true, true, false); - do_test(true, true, true); + do_test(false, false); + do_test(false, true); + do_test(true, false); + do_test(true, true); } } diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java index c7d91637b38..a4c470e5ba4 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,9 +64,6 @@ public class TestCrashOnOutOfMemoryError { /* Output should look something like this. The actual text will depend on the OS and its core dump processing. Aborting due to java.lang.OutOfMemoryError: Requested array size exceeds VM limit - # To suppress the following error report, specify this argument - # after -XX: or in .hotspotrc: SuppressErrorAt=/debug.cpp:303 - # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (/home/cheleswer/Desktop/jdk9/dev/hotspot/src/share/vm/utilities/debug.cpp:303), pid=6212, tid=6213 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace003.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace003.java index 6115673b71e..91c2d51c787 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,51 +40,6 @@ * method. * This test is almost the same as nsk.stress.strace.strace001 except for * the recursive method is a native one. - * COMMENTS - * Below assertion is revealed on engineer's build. It is needed to check - * on a promoted build. - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Started at: Fri Apr 25 15:47:13 NSK 2003 - * waiting for all threads started ... - * >>> snapshot 1 - * checking strace003Thread0(trace elements: 2) - * checking strace003Thread1(trace elements: 2) - * checking strace003Thread2(trace elements: 3) - * checking strace003Thread3(trace elements: 2) - * checking strace003Thread4(trace elements: 2) - * checking strace003Thread5(trace elements: 2) - * checking strace003Thread6(trace elements: 3) - * checking strace003Thread7(trace elements: 2) - * # To suppress the following error report, specify this argument - * # after -XX: or in .hotspotrc: SuppressErrorAt=/jniHandles.hpp:157 - * # - * # HotSpot Virtual Machine Error, assertion failure - * # Please report this error at - * # http://java.sun.com/cgi-bin/bugreport.cgi - * # - * # Java VM: Java HotSpot(TM) Client VM (1.4.1-internal-debug mixed mode) - * # - * # assert(result != ((oop)::badJNIHandleVal), "Pointing to zapped jni handle area") - * # - * # Error ID: src/share/vm/runtime/jniHandles.hpp, 157 [ Patched ] - * # - * # Problematic Thread: prio=5 tid=0x001b99e8 nid=0xbf runnable - * # - * Heap at VM Abort: - * Heap - * def new generation total 2112K, used 300K [0xf1800000, 0xf1a20000, 0xf1f10000) - * eden space 2048K, 14% used [0xf1800000, 0xf184b358, 0xf1a00000) - * from space 64K, 0% used [0xf1a00000, 0xf1a00000, 0xf1a10000) - * to space 64K, 0% used [0xf1a10000, 0xf1a10000, 0xf1a20000) - * tenured generation total 1408K, used 0K [0xf1f10000, 0xf2070000, 0xf5800000) - * the space 1408K, 0% used [0xf1f10000, 0xf1f10000, 0xf1f10200, 0xf2070000) - * compacting perm gen total 4096K, used 1024K [0xf5800000, 0xf5c00000, 0xf9800000) - * the space 4096K, 25% used [0xf5800000, 0xf5900240, 0xf5900400, 0xf5c00000) - * Dumping core.... - * Abort - * Finished at: Fri Apr 25 15:48:10 NSK 2003 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * * @library /vmTestbase * /test/lib * @run main/othervm/native nsk.stress.strace.strace003 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace004.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace004.java index c0cc9cf1321..8874289e9cb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,43 +40,6 @@ * method. * This test is almost the same as nsk.stress.strace.strace003 except for * checking is performed for java.lang.Thread.getAllStackTraces() method. - * COMMENTS - * java.lang.Thread.getAllStackTraces() is too slow method. So it is not successed - * to catch an alive thread during execution of this method for the first snapshot - * and it is needed to check on a promoted build due to the below assertion. - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * waiting for all threads started ... - * >>> snapshot 1 - * waiting for threads finished - * # To suppress the following error report, specify this argument - * # after -XX: or in .hotspotrc: SuppressErrorAt=/jniHandles.hpp:157 - * # - * # HotSpot Virtual Machine Error, assertion failure - * # Please report this error at - * # http://java.sun.com/cgi-bin/bugreport.cgi - * # - * # Java VM: Java HotSpot(TM) Client VM (1.4.1-internal-debug mixed mode) - * # - * # assert(result != ((oop)::badJNIHandleVal), "Pointing to zapped jni handle area") - * # - * # Error ID: src/share/vm/runtime/jniHandles.hpp, 157 [ Patched ] - * # - * # Problematic Thread: prio=5 tid=0x001976e0 nid=0x96 runnable - * # - * Heap at VM Abort: - * Heap - * def new generation total 2112K, used 455K [0xf1800000, 0xf1a20000, 0xf1f10000) - * eden space 2048K, 22% used [0xf1800000, 0xf1871f60, 0xf1a00000) - * from space 64K, 0% used [0xf1a00000, 0xf1a00000, 0xf1a10000) - * to space 64K, 0% used [0xf1a10000, 0xf1a10000, 0xf1a20000) - * tenured generation total 1408K, used 0K [0xf1f10000, 0xf2070000, 0xf5800000) - * the space 1408K, 0% used [0xf1f10000, 0xf1f10000, 0xf1f10200, 0xf2070000) - * compacting perm gen total 4096K, used 1025K [0xf5800000, 0xf5c00000, 0xf9800000) - * the space 4096K, 25% used [0xf5800000, 0xf5900660, 0xf5900800, 0xf5c00000) - * Dumping core.... - * Abort - * Finished at: Fri Apr 25 18:01:37 NSK 2003 - * * @library /vmTestbase * /test/lib * @run main/othervm/native nsk.stress.strace.strace004 diff --git a/test/lib-test/jdk/test/whitebox/vm_flags/StringTest.java b/test/lib-test/jdk/test/whitebox/vm_flags/StringTest.java index ac4b4f2bf65..80ef2048387 100644 --- a/test/lib-test/jdk/test/whitebox/vm_flags/StringTest.java +++ b/test/lib-test/jdk/test/whitebox/vm_flags/StringTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,14 +36,14 @@ public class StringTest { private static final String FLAG_NAME = "CompileOnly"; - private static final String FLAG_DEBUG_NAME = "SuppressErrorAt"; + private static final String FLAG_DEBUG_NAME = "ExitOnFullCodeCache"; private static final String[] TESTS = {"StringTest::*", ""}; public static void main(String[] args) throws Exception { VmFlagTest.runTest(FLAG_NAME, TESTS, VmFlagTest.WHITE_BOX::setStringVMFlag, VmFlagTest.WHITE_BOX::getStringVMFlag); - VmFlagTest.runTest(FLAG_DEBUG_NAME, VmFlagTest.WHITE_BOX::getStringVMFlag); + VmFlagTest.runTest(FLAG_DEBUG_NAME, VmFlagTest.WHITE_BOX::getBooleanVMFlag); } }