[
https://issues.apache.org/jira/browse/HADOOP-8486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13290389#comment-13290389
]
Kanna Karanam commented on HADOOP-8486:
---------------------------------------
Thanks Bikas.
I see it as two issues –
1) Resource leak – which I am addressing here. (It is better to fix this
irrespective of HIVE usage)
2) Hive improvement – I am investigating to find an alternative to
validate the file format without creating Sequence File object.
< are you sure about calling close() on a partially constructed object>
I thought of closing the file handle in Init method before throwing
exception(s) from various places in the Init method, but feel like a lot of
redundant code. Close function has right protection to handle the partially
constructed resources so it is safe to call the close directly from the
constructor.
<in !=null>
We have OpenFile function call in the constructor and it can throw
IOException so when we call the close method from constructor it will attempt
to close (in.close()) on null object.
> Resource leak - Close the open resource handles (File handles) before
> throwing the exception from the SequenceFile constructor
> ------------------------------------------------------------------------------------------------------------------------------
>
> Key: HADOOP-8486
> URL: https://issues.apache.org/jira/browse/HADOOP-8486
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs, io
> Affects Versions: 1.0.2
> Reporter: Kanna Karanam
> Attachments: HADOOP-8486-branch-1-win.patch
>
>
> I noticed this problem while I am working on porting HIVE to work on windows.
> Hive is attempting to create this class object to validate the file format
> and end up with resource leak. Because of this leak, we can’t move, rename or
> delete the files on windows when there is an open file handle whereas in UNIX
> we can perform all these operation with no issues even with open file handles.
> Please suggest me if you similar issues in any other places.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira