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

Chris Nauroth commented on HDFS-9354:
-------------------------------------

Hi [~xyao].  Thanks for tracking down these file handle leaks.  I have a couple 
of thoughts that might help {{TestBalancer}} become more resilient to these 
kinds of problems in the future.

# We could add a JUnit {{@After}} method that always shuts down {{cluster}} if 
it is non-null.  Then, the individual tests wouldn't need to do try-finally, 
and any new tests that get added over time will get the automatic shutdown for 
free.  This would require a bigger patch though.
# The check for {{HadoopIllegalArgumentException}} could be simplified by using 
JUnit's {{ExpectedException}} rule.  If you'd like to see a simple example of 
this, I recommend looking at {{TestAclConfigFlag}}.

Please let me know your thoughts on this.  Thanks again!

> Fix TestBalancer#testBalancerWithZeroThreadsForMove on Windows
> --------------------------------------------------------------
>
>                 Key: HDFS-9354
>                 URL: https://issues.apache.org/jira/browse/HDFS-9354
>             Project: Hadoop HDFS
>          Issue Type: Test
>            Reporter: Xiaoyu Yao
>            Assignee: Xiaoyu Yao
>         Attachments: HDFS-9354.00.patch
>
>
> This negative test expect HadoopIllegalArgumentException on illegal 
> configuration. It uses JUnit (expected=HadoopIllegalArgumentException.class)  
> and passed fine on Linux.
> On windows, this test passes as well. But it left open handles on NN metadata 
> directories used by MiniDFSCluster. As a result, quite a few of subsequent 
> TestBalancer unit tests can't start MiniDFSCluster. The open handles prevents 
> them from cleaning up NN metadata directories on Windows. 
> This JIRA is opened to explicitly catch the Exception and ensure the test 
> cluster is properly shutdown.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to