hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uma Maheswara Rao G (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-1753) Resource Leak in org.apache.hadoop.hdfs.server.namenode.StreamFile
Date Tue, 28 Jun 2011 09:22:17 GMT

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

Uma Maheswara Rao G commented on HDFS-1753:
-------------------------------------------


Hi Nicholas,
 Thanks for reviewing the patch.
  Based on the discussions in 
https://issues.apache.org/jira/browse/MAPREDUCE-2243 
I am preferring to use this approach.

{quote}
It seems the code above is not needed since they will be closed in the finally- block. No?
{quote}


 If stream closed successfully in try block itself then stream will be nullified, So IOUtils.closeStream(in);
will not do any thing in finally block, because closeStream method will check for null.
 If stream closure failed because of some unexpected exception, then finally block will retry
for stream closure. After this, flow will go to catch block.
  Just closing the streams in finally block by suppressing the stream closure exceptions will
not be sufficient as stream closure is also part of the functionality. To avoid masking these
exceptions, let it be closed in try block itself.
  If we close the stream in finally block with out suppressing the closure exceptions, it
may mask the root exception.

 some more disscussions from https://issues.apache.org/jira/browse/HADOOP-7194.



> Resource Leak in org.apache.hadoop.hdfs.server.namenode.StreamFile
> ------------------------------------------------------------------
>
>                 Key: HDFS-1753
>                 URL: https://issues.apache.org/jira/browse/HDFS-1753
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: name-node
>            Reporter: Uma Maheswara Rao G
>            Assignee: Uma Maheswara Rao G
>            Priority: Minor
>         Attachments: HDFS-1753.1.patch, HDFS-1753.2.patch, HDFS-1753.patch
>
>
> In doGet Method, 
> final DFSInputStream in = dfs.open(filename);
> final long fileLen = in.getFileLength();
> OutputStream os = response.getOutputStream(); 
> Here this lines are present at out side of the try block.
> If response.getOutputStream() throws any exception then DFSInputStream will not be closed.So,
better to move response.getOutputStream() into try block.
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message