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

Yongjun Zhang commented on HADOOP-11392:
----------------------------------------

Hi [~brahmareddy],

Thanks for finding the issue here and good catch of yours!

I have a few comments on the patch:
*  I saw there are two places that have the same issue in the same file, can we 
address them altogether?
*  Need to check whether a stream is null before calling IOUtils.closeStream. 
Instead of adding the check here, I think we can fix 
{{public static void cleanup(Log log, java.io.Closeable... closeables) {}} by 
adding a check in the beginning.
*  Format nit, put line 446-448 to the same line
{code}
446           }
447            finally
448           {
449               IOUtils.closeStream(out);
450               IOUtils.closeStream(in);
451           }
{code}
Thanks.


> FileUtil.java leaks file descriptor when copybytes success.
> -----------------------------------------------------------
>
>                 Key: HADOOP-11392
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11392
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Brahma Reddy Battula
>            Assignee: Brahma Reddy Battula
>         Attachments: HADOOP-11392.patch
>
>
>  Please check following code for same..
> {code}
> try {
>         in = srcFS.open(src);
>         out = dstFS.create(dst, overwrite);
>         IOUtils.copyBytes(in, out, conf, true);
>       } catch (IOException e) {
>         IOUtils.closeStream(out);
>         IOUtils.closeStream(in);
>         throw e;
>       }
>     }
> {code}



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

Reply via email to