Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D5994401D for ; Sat, 9 Jul 2011 14:21:42 +0000 (UTC) Received: (qmail 87536 invoked by uid 500); 9 Jul 2011 14:21:41 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 87444 invoked by uid 500); 9 Jul 2011 14:21:41 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 86927 invoked by uid 500); 9 Jul 2011 14:21:41 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 86850 invoked by uid 99); 9 Jul 2011 14:21:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Jul 2011 14:21:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Jul 2011 14:21:38 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 4CCDD4F3D6 for ; Sat, 9 Jul 2011 14:21:17 +0000 (UTC) Date: Sat, 9 Jul 2011 14:21:17 +0000 (UTC) From: "Chinna Rao Lalam (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: <434295667.14143.1310221277311.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <8885651.156961294221226304.JavaMail.jira@thor> Subject: [jira] [Commented] (HIVE-1884) Potential risk of resource leaks in Hive MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HIVE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13062387#comment-13062387 ] Chinna Rao Lalam commented on HIVE-1884: ---------------------------------------- patch is rebased against trunk. > Potential risk of resource leaks in Hive > ---------------------------------------- > > Key: HIVE-1884 > URL: https://issues.apache.org/jira/browse/HIVE-1884 > Project: Hive > Issue Type: Bug > Components: CLI, Metastore, Query Processor, Server Infrastructure > Affects Versions: 0.3.0, 0.4.0, 0.4.1, 0.5.0, 0.6.0 > Environment: Hive 0.6.0, Hadoop 0.20.1 > SUSE Linux Enterprise Server 11 (i586) > Reporter: Mohit Sikri > Assignee: Chinna Rao Lalam > Attachments: HIVE-1884.1.PATCH, HIVE-1884.2.patch, HIVE-1884.3.patch > > > h3.There are couple of resource leaks. > h4.For example, > In CliDriver.java, Method :- processReader() the buffered reader is not closed. > h3.Also there are risk(s) of resource(s) getting leaked , in such cases we need to re factor the code to move closing of resources in finally block. > h4. For Example :- > In Throttle.java Method:- checkJobTracker() , the following code snippet might cause resource leak. > {code} > InputStream in = url.openStream(); > in.read(buffer); > in.close(); > {code} > Ideally and as per the best coding practices it should be like below > {code} > InputStream in=null; > try { > in = url.openStream(); > int numRead = in.read(buffer); > } > finally { > IOUtils.closeStream(in); > } > {code} > Similar cases, were found in ExplainTask.java, DDLTask.java etc.Need to re factor all such occurrences. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira