You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Chris Nauroth (JIRA)" <ji...@apache.org> on 2013/07/01 21:48:20 UTC
[jira] [Commented] (HADOOP-9681) FileUtil.unTarUsingJava() should
close the InputStream upon finishing
[ https://issues.apache.org/jira/browse/HADOOP-9681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13697101#comment-13697101 ]
Chris Nauroth commented on HADOOP-9681:
---------------------------------------
Good catch. Thanks, Chuan!
Can you please close these streams in a finally block to guarantee that they get closed even if there are exceptions? Also, using {{IOUtils#cleanup}} would shorten the code a bit.
This method also exists in branch-1-win with the same bug. Can you post a branch-1-win patch too?
> FileUtil.unTarUsingJava() should close the InputStream upon finishing
> ---------------------------------------------------------------------
>
> Key: HADOOP-9681
> URL: https://issues.apache.org/jira/browse/HADOOP-9681
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 3.0.0, 2.1.0-beta
> Reporter: Chuan Liu
> Assignee: Chuan Liu
> Priority: Minor
> Attachments: HADOOP-9681-trunk.patch
>
>
> In {{FileUtil.unTarUsingJava()}} method, we did not close input steams explicitly upon finish. This could lead to a file handle leak on Windows.
> I discovered this when investigating the unit test case failure of {{TestFSDownload.testDownloadArchive()}}. FSDownload class will use {{FileUtil.unTarUsingJava()}} to unpack some temporary archive file. Later, the temporary file should be deleted. Because of the file handle leak, the {{File.delete()}} method fails. The test case then fails because it assert the temporary file should not exist.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira