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

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

ayushtkn commented on code in PR #5372:
URL: https://github.com/apache/hadoop/pull/5372#discussion_r1101038386


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestSymlinkHdfs.java:
##########
@@ -100,7 +100,7 @@ public static void afterClassTeardown() throws Exception {
     if (cluster != null) {
       cluster.shutdown();
     }
-    IOUtils.closeQuietly(webhdfs);
+    IOUtils.closeStream(webhdfs);

Review Comment:
   I am not sure what @steveloughran meant here:
   https://github.com/apache/hadoop/pull/5342#issuecomment-1422976653
   by
   ```
   should have said use o.a.hadoop.utils.IOUtils.closeStream(), because that 
one logs at debug if an exception is raised
   ```
   
   ``IOUtils.closeStream(webhdfs);`` won't be logging either.
   Check the code:
   It calls ``cleanUpWithLogger``, with Logger passed as ``null``
   ```
     public static void closeStream(java.io.Closeable stream) {
       if (stream != null) {
         cleanupWithLogger(null, stream);
       }
   ```
   And ``cleanUpWithLogger`` won't log because we passed ``null`` for ``logger``
   ```
           } catch (Throwable e) {
             if (logger != null) {
               logger.debug("Exception in closing {}", c, e);
             }
   ```
   
   May be the intention was to ask: use `` IOUtils.cleanupWithLogger(LOG, 
webhdfs);``





> Close webhdfs during the teardown
> ---------------------------------
>
>                 Key: HDFS-16904
>                 URL: https://issues.apache.org/jira/browse/HDFS-16904
>             Project: Hadoop HDFS
>          Issue Type: Test
>          Components: hdfs
>    Affects Versions: 3.4.0, 3.3.5, 3.3.9
>         Environment: Tested using the Hadoop development environment Docker 
> image.
>            Reporter: Steve Vaughan
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.4.0, 3.3.9
>
>
> The teardown for the tests shutdown the cluster, but leaves HDFS open.



--
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