[ 
https://issues.apache.org/jira/browse/HDFS-17957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18104294#comment-18104294
 ] 

ASF GitHub Bot commented on HDFS-17957:
---------------------------------------

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


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/TestNNWithQJM.java:
##########
@@ -36,12 +36,16 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 
 
 public class TestNNWithQJM {
+  private static final Logger LOG =

Review Comment:
   The logger is used once, in the testNewNamenodeTakesOverWriter, the the 
catch(ExitUntil.ExitException) block logs the expected exit. This keeps the 
shutdown failure visible in the test output rather than silently ignoring it.





> Cleanup of leaked mini-cluster instances in tests and review timeout values
> ---------------------------------------------------------------------------
>
>                 Key: HDFS-17957
>                 URL: https://issues.apache.org/jira/browse/HDFS-17957
>             Project: Hadoop HDFS
>          Issue Type: Test
>          Components: test
>            Reporter: Jose Luis López
>            Priority: Minor
>              Labels: pull-request-available
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> Tests in hadoop-hdfs-project leak mini-cluster instances. A leaked cluster
> holds NameNode and DataNode threads, heap and ports open for the rest of the
> class, so one real failure produces several bogus ones.
>  
> A static scan of the test sources found 82 real cases repo-wide. This issue
> covers the 67 in hadoop-hdfs-project, in three categories:
>  
> A) 22 never shut the cluster down on any path.
> B) 36 shut it down only on the happy path, so it leaks exactly when the
> test fails.
> C) 9 hold it in a field with no teardown in the class or its superclasses.
>  
> Fixes are try-with-resources, shutdown() in finally, or @AfterEach. The 15
> cases outside this scope are will get their own JIRAs.
>  
> Two further defects found while running these tests:
>  
> TestFsVolumeList also needs an assertion fix, without which it stays red.
> testAddRplicaProcessorForAddingReplicaInMap compares the configured pool size
> against BlockPoolSlice#getAddReplicaForkPoolSize(), which returns the lazily
> grown ForkJoinPool#getPoolSize() - the source of its "expected: <5> but was:
> <4>" failures. The @VisibleForTesting getter now returns getParallelism(). It
> has no production callers.
>  
> Seven timeout budgets are mis-calibrated. Four @Timeout values are written in
> milliseconds as if seconds (30000, 30000, 300000, 100000). Three are shorter
> than the waits they wrap. hadoop-hdfs and hadoop-hdfs-rbf also gain
> junit.jupiter.execution.timeout.default (600s and 1800s), so a hang in a
> method with no explicit @Timeout fails as a named per-method timeout instead
> of a surefire fork kill that discards the whole class's results.
>  
> Follow-up once this merges: remove TestFsVolumeList from 
> .github/gha-tests/exclude-tests.txt (line 56).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to