Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF2AE953A for ; Wed, 6 Jun 2012 20:56:24 +0000 (UTC) Received: (qmail 86446 invoked by uid 500); 6 Jun 2012 20:56:23 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 86350 invoked by uid 500); 6 Jun 2012 20:56:23 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 86162 invoked by uid 99); 6 Jun 2012 20:56:23 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2012 20:56:23 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 53B9F142860 for ; Wed, 6 Jun 2012 20:56:23 +0000 (UTC) Date: Wed, 6 Jun 2012 20:56:23 +0000 (UTC) From: "Kanna Karanam (JIRA)" To: common-issues@hadoop.apache.org Message-ID: <1406043812.44869.1339016183345.JavaMail.jiratomcat@issues-vm> In-Reply-To: <692135837.44573.1339010902918.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Commented] (HADOOP-8486) Resource leak - Close the open resource handles (File handles) before throwing the exception from the SequenceFile constructor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HADOOP-8486?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D132= 90389#comment-13290389 ]=20 Kanna Karanam commented on HADOOP-8486: --------------------------------------- Thanks Bikas. I see it as two issues =E2=80=93 1)=09Resource leak =E2=80=93 which I am addressing here. (It is better to f= ix this irrespective of HIVE usage) 2)=09Hive improvement =E2=80=93 I am investigating to find an alternative t= o validate the file format without creating Sequence File object.=20 < are you sure about calling close() on a partially constructed object> I thought of closing the file handle in Init method before throwing exc= eption(s) from various places in the Init method, but feel like a lot of r= edundant code. Close function has right protection to handle the partially = constructed resources so it is safe to call the close directly from the con= structor. We have OpenFile function call in the constructor and it can throw IOEx= ception so when we call the close method from constructor it will attempt t= o close (in.close()) on null object. =20 =20 > Resource leak - Close the open resource handles (File handles) before thr= owing 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 wind= ows. Hive is attempting to create this class object to validate the file fo= rmat and end up with resource leak. Because of this leak, we can=E2=80=99t = move, rename or delete the files on windows when there is an open file hand= le whereas in UNIX we can perform all these operation with no issues even w= ith 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 administrato= rs: https://issues.apache.org/jira/secure/ContactAdministrators!default.jsp= a For more information on JIRA, see: http://www.atlassian.com/software/jira