You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Raghu Angadi (JIRA)" <ji...@apache.org> on 2008/07/24 21:13:31 UTC
[jira] Reopened: (HADOOP-3592) org.apache.hadoop.fs.FileUtil.copy()
will leak input streams if the destination can't be opened
[ https://issues.apache.org/jira/browse/HADOOP-3592?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Raghu Angadi reopened HADOOP-3592:
----------------------------------
Reverting the patch.
There are multiple issues with the patch :
# Unit test TestCLI failed during Hudson for this jira and is caused by it.
# Patch committed is not same as the patch attached (check svn revision 678692).
# Code clean ups are useful but we need to be really careful and review every change. E.g.
#* This patch replaces lot of {{'inorout.close()'}} calls with {{IOUtils.closeStream(inorout)}}, which is pretty dangerous.
#* {{closeStream()}} should only be used if you want to ignore exceptions from close(). i.e. what happens when {{out.close()}} fails in {{copyMerge()}}? You could end up with truncated file.
#* I think every other code clean up should be carefully reviewed.
> org.apache.hadoop.fs.FileUtil.copy() will leak input streams if the destination can't be opened
> -----------------------------------------------------------------------------------------------
>
> Key: HADOOP-3592
> URL: https://issues.apache.org/jira/browse/HADOOP-3592
> Project: Hadoop Core
> Issue Type: Bug
> Components: fs
> Affects Versions: 0.19.0
> Reporter: Steve Loughran
> Assignee: Bill de hOra
> Priority: Minor
> Fix For: 0.19.0
>
> Attachments: HADOOP-3592.patch, HADOOP-3592.patch
>
>
> FileUtil.copy() relies on IOUtils.copyBytes() to close the incoming streams, which it does. Normally.
> But if dstFS.create() raises any kind of IOException, then the inputstream "in", which was created in the line above, will never get closed, and hence be leaked.
> InputStream in = srcFS.open(src);
> OutputStream out = dstFS.create(dst, overwrite);
> IOUtils.copyBytes(in, out, conf, true);
> Some try/catch wrapper around the open operations could close the streams if any exception gets thrown at that point in the copy process.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.