HADOOP-8894. GenericTestUtils.waitFor should dump thread stacks on timeout. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1395825 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
03c96ef29e
commit
ad9bcb9e5a
@ -297,6 +297,9 @@ Release 2.0.3-alpha - Unreleased
|
||||
HADOOP-8804. Improve Web UIs when the wildcard address is used.
|
||||
(Senthil Kumar via eli)
|
||||
|
||||
HADOOP-8894. GenericTestUtils.waitFor should dump thread stacks on timeout
|
||||
(todd)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HADOOP-8866. SampleQuantiles#query is O(N^2) instead of O(N). (Andrew Wang
|
||||
|
@ -104,7 +104,10 @@ public static void waitFor(Supplier<Boolean> check,
|
||||
|
||||
Thread.sleep(checkEveryMillis);
|
||||
} while (Time.now() - st < waitForMillis);
|
||||
throw new TimeoutException("Timed out waiting for condition");
|
||||
|
||||
throw new TimeoutException("Timed out waiting for condition. " +
|
||||
"Thread diagnostics:\n" +
|
||||
TimedOutTestsListener.buildThreadDiagnosticString());
|
||||
}
|
||||
|
||||
public static class LogCapturer {
|
||||
|
@ -58,6 +58,14 @@ public void testFailure(Failure failure) throws Exception {
|
||||
&& failure.getMessage().startsWith(TEST_TIMED_OUT_PREFIX)) {
|
||||
output.println("====> TEST TIMED OUT. PRINTING THREAD DUMP. <====");
|
||||
output.println();
|
||||
output.print(buildThreadDiagnosticString());
|
||||
}
|
||||
}
|
||||
|
||||
public static String buildThreadDiagnosticString() {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter output = new PrintWriter(sw);
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss,SSS");
|
||||
output.println(String.format("Timestamp: %s", dateFormat.format(new Date())));
|
||||
output.println();
|
||||
@ -69,7 +77,8 @@ public void testFailure(Failure failure) throws Exception {
|
||||
output.println();
|
||||
output.println(deadlocksInfo);
|
||||
}
|
||||
}
|
||||
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
static String buildThreadDump() {
|
||||
|
Loading…
Reference in New Issue
Block a user