joseluisll commented on code in PR #8682:
URL: https://github.com/apache/hadoop/pull/8682#discussion_r3813786719


##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java:
##########
@@ -399,11 +399,13 @@ public static void waitFor(final Supplier<Boolean> check,
     }
 
     if (!result) {
+      // Dump now, while the threads are still hung: TimedOutTestsListener
+      // only sees the failure once the test and its teardown have unwound.
+      TimedOutTestsListener.dumpForTimeout("GenericTestUtils.waitFor");
       final String exceptionErrorMsg = "Timed out waiting for condition. "
           + (org.apache.commons.lang3.StringUtils.isNotEmpty(errorMsg)
-          ? "Error Message: " + errorMsg : "")
-          + "\nThread diagnostics:\n" +
-          TimedOutTestsListener.buildThreadDiagnosticString();
+          ? "Error Message: " + errorMsg + " " : "")
+          + TimedOutTestsListener.DUMP_PRINTED_MARKER;

Review Comment:
   Fixed — dumpForTimeout returns whether it printed, and waitFor appends the 
marker only then.
   
   Checked the second half of your point too: omitting the marker can't produce 
a double dump. Both paths that make shouldDump() refuse — the off switch and an 
exhausted per-JVM budget — refuse identically when the listener asks, so 
there's no second dump to suppress.
   
   New cases pin the exact message in all three states: dump printed, 
-Dhadoop.test.timedout.dump=false, and budget spent.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to