[
https://issues.apache.org/jira/browse/HADOOP-19964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18105831#comment-18105831
]
ASF GitHub Bot commented on HADOOP-19964:
-----------------------------------------
pan3793 commented on code in PR #8682:
URL: https://github.com/apache/hadoop/pull/8682#discussion_r3811361992
##########
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:
`DUMP_PRINTED_MARKER` ("Thread dump printed to stderr.") is appended
unconditionally, but `dumpForTimeout` may have printed nothing —
`shouldDump()`
returns false when `-Dhadoop.test.timedout.dump=false` or the per-JVM limit
is
reached. The message then asserts a dump happened when it didn't, and the
listener's `dumpAlreadyPrinted()` sees the marker and stays quiet. Gate the
marker
on whether a dump was actually emitted (e.g., have `dumpForTimeout` return
whether
it printed).
> Restore TimedOutTestsListener thread dumps on test timeout
> ----------------------------------------------------------
>
> Key: HADOOP-19964
> URL: https://issues.apache.org/jira/browse/HADOOP-19964
> Project: Hadoop Common
> Issue Type: Test
> Reporter: Jose Luis López
> Priority: Critical
> Labels: pull-request-available
>
> Goal: a test that fails on @Timeout prints a full thread dump into its
> surefire report. Today it prints nothing, and a timeout without thread state
> is undiagnosable after the fact.
>
> This is a regression. TimedOutTestsListener (HADOOP-8755, 2012) did exactly
> this until the JUnit 5 migration (HADOOP-19415 Part4) left it implementing no
> listener interface. The Surefire "listener" property that 8 poms still carry
> registers nothing.
>
> Fix:
> * Reimplement it as a JUnit Platform TestExecutionListener, auto-registered
> via META-INF/services in the hadoop-common test artifact.
> * Remove the dead "listener" property from the 8 poms.
> * -Dhadoop.test.timedout.dump=false turns it off;
> -Dhadoop.test.timedout.dump.limit (default 5) caps dumps per JVM.
>
> Covers timeouts that fail through JUnit. Does not cover Surefire's fork kill
> (forkedProcessTimeoutInSeconds), which halts the JVM and bypasses listeners.
> Complements HADOOP-19950, whose CI upload globs already capture the report
> files these dumps land in.
>
> The listener activates for every consumer of the hadoop-common test artifact,
> including HBase, Ozone, Hive and Tez: needs a release note.
>
> Test-scope only; no production code is touched.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]