mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8303861: Error handling step timeouts should never be blocked by OnError and others
Reviewed-by: dholmes, rkennke
This commit is contained in:
parent
da044dd569
commit
a00f5d24d3
3 changed files with 92 additions and 36 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 2022 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2023, Red Hat, Inc. and/or its affiliates.
|
||||
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
|
@ -26,6 +27,9 @@ import java.io.BufferedReader;
|
|||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
@ -33,7 +37,7 @@ import jdk.test.lib.Platform;
|
|||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @test id=default
|
||||
* @bug 8166944
|
||||
* @summary Hanging Error Reporting steps may lead to torn error logs
|
||||
* @modules java.base/jdk.internal.misc
|
||||
|
@ -43,6 +47,16 @@ import jdk.test.lib.process.ProcessTools;
|
|||
* @author Thomas Stuefe (SAP)
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test id=with-on-error
|
||||
* @bug 8303861
|
||||
* @summary Error handling step timeouts should never be blocked by OnError etc.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /test/lib
|
||||
* @requires (vm.debug == true) & (os.family != "windows")
|
||||
* @run driver TimeoutInErrorHandlingTest with-on-error
|
||||
*/
|
||||
|
||||
public class TimeoutInErrorHandlingTest {
|
||||
|
||||
public static final boolean verbose = System.getProperty("verbose") != null;
|
||||
|
@ -71,14 +85,28 @@ public class TimeoutInErrorHandlingTest {
|
|||
* little timeout messages to see that repeated timeout handling is basically working.
|
||||
*/
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-Xmx100M",
|
||||
"-XX:ErrorHandlerTest=14",
|
||||
"-XX:+TestUnresponsiveErrorHandler",
|
||||
"-XX:ErrorLogTimeout=" + ERROR_LOG_TIMEOUT,
|
||||
"-XX:-CreateCoredumpOnCrash",
|
||||
"-version");
|
||||
boolean withOnError = false;
|
||||
|
||||
if (args.length > 0) {
|
||||
switch (args[0]) {
|
||||
case "with-on-error": withOnError = true; break;
|
||||
default: throw new RuntimeException("Invalid argument " + args[1]);
|
||||
}
|
||||
}
|
||||
|
||||
List<String> arguments = new ArrayList<>();
|
||||
Collections.addAll(arguments,
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-Xmx100M",
|
||||
"-XX:ErrorHandlerTest=14",
|
||||
"-XX:+TestUnresponsiveErrorHandler",
|
||||
"-XX:ErrorLogTimeout=" + ERROR_LOG_TIMEOUT,
|
||||
"-XX:-CreateCoredumpOnCrash");
|
||||
if (withOnError) {
|
||||
arguments.add("-XX:OnError=echo hi");
|
||||
}
|
||||
arguments.add("-version");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(arguments);
|
||||
|
||||
OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
|
||||
|
||||
|
@ -92,8 +120,10 @@ public class TimeoutInErrorHandlingTest {
|
|||
output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*");
|
||||
output_detail.shouldMatch("# +(?:SIGSEGV|SIGBUS|EXCEPTION_ACCESS_VIOLATION).*");
|
||||
|
||||
// VM should have been aborted by WatcherThread
|
||||
output_detail.shouldMatch(".*timer expired, abort.*");
|
||||
// Unless we specified OnError, VM should have been aborted by WatcherThread
|
||||
if (!withOnError) {
|
||||
output_detail.shouldMatch(".*timer expired, abort.*");
|
||||
}
|
||||
|
||||
// extract hs-err file
|
||||
File hs_err_file;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue