[
https://issues.apache.org/jira/browse/HADOOP-7090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13060035#comment-13060035
]
Hudson commented on HADOOP-7090:
--------------------------------
Integrated in Hadoop-Common-trunk-Commit #672 (See
[https://builds.apache.org/job/Hadoop-Common-trunk-Commit/672/])
HADOOP-7090. Fix resource leaks in s3.INode, BloomMapFile, WritableUtils
and CBZip2OutputStream. Contributed by Uma Maheswara Rao G
szetszwo :
http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1143149
Files :
* /hadoop/common/trunk/common/src/java/org/apache/hadoop/io/WritableUtils.java
* /hadoop/common/trunk/common/CHANGES.txt
* /hadoop/common/trunk/common/src/java/org/apache/hadoop/fs/s3/INode.java
* /hadoop/common/trunk/common/src/java/org/apache/hadoop/io/BloomMapFile.java
*
/hadoop/common/trunk/common/src/java/org/apache/hadoop/io/compress/bzip2/CBZip2OutputStream.java
> Possible resource leaks in hadoop core code
> -------------------------------------------
>
> Key: HADOOP-7090
> URL: https://issues.apache.org/jira/browse/HADOOP-7090
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs/s3, io
> Affects Versions: 0.21.0, 0.23.0
> Reporter: Gokul
> Assignee: Uma Maheswara Rao G
> Fix For: 0.23.0
>
> Attachments: HADOOP-7090.0.patch, HADOOP-7090.patch
>
>
> It is always a good practice to close the IO streams in a finally block..
> For example, look at the following piece of code in the Writer class of
> BloomMapFile
> {code:title=BloomMapFile .java|borderStyle=solid}
> public synchronized void close() throws IOException {
> super.close();
> DataOutputStream out = fs.create(new Path(dir, BLOOM_FILE_NAME), true);
> bloomFilter.write(out);
> out.flush();
> out.close();
> }
> {code}
> If an exception occurs during fs.create or on any other line, out.close()
> will not be executed..
> The following can reduce the scope of resorce leaks..
> {code:title=BloomMapFile .java|borderStyle=solid}
> public synchronized void close() throws IOException {
> super.close();
> DataOutputStream out = null;
> try{
> out = fs.create(new Path(dir, BLOOM_FILE_NAME), true);
> bloomFilter.write(out);
> out.flush();
> }finally{
> IOUtils.closeStream(out);
> }
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira