Return-Path: X-Original-To: apmail-hadoop-mapreduce-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-mapreduce-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 4AD564083 for ; Fri, 1 Jul 2011 14:26:51 +0000 (UTC) Received: (qmail 18968 invoked by uid 500); 1 Jul 2011 14:26:51 -0000 Delivered-To: apmail-hadoop-mapreduce-issues-archive@hadoop.apache.org Received: (qmail 18757 invoked by uid 500); 1 Jul 2011 14:26:50 -0000 Mailing-List: contact mapreduce-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mapreduce-issues@hadoop.apache.org Delivered-To: mailing list mapreduce-issues@hadoop.apache.org Received: (qmail 18740 invoked by uid 99); 1 Jul 2011 14:26:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2011 14:26:50 +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; Fri, 01 Jul 2011 14:26:49 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 0548843E447 for ; Fri, 1 Jul 2011 14:26:29 +0000 (UTC) Date: Fri, 1 Jul 2011 14:26:29 +0000 (UTC) From: "Ravi Teja Ch N V (JIRA)" To: mapreduce-issues@hadoop.apache.org Message-ID: <1863650216.8677.1309530389018.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <657753516.4505.1309411108778.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ravi Teja Ch N V updated MAPREDUCE-2631: ---------------------------------------- Fix Version/s: 0.23.0 Status: Patch Available (was: Open) > Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java > --------------------------------------------------------------------------------------- > > Key: MAPREDUCE-2631 > URL: https://issues.apache.org/jira/browse/MAPREDUCE-2631 > Project: Hadoop Map/Reduce > Issue Type: Bug > Components: jobtracker > Affects Versions: 0.23.0 > Reporter: Ravi Teja Ch N V > Fix For: 0.23.0 > > Attachments: MAPREDUCE-2631.patch > > > {code:title=TaskLogServlet.java|borderStyle=solid} > private void printTaskLog(HttpServletResponse response, > OutputStream out, TaskAttemptID taskId, > long start, long end, boolean plainText, > TaskLog.LogName filter, boolean isCleanup) > throws IOException { > if (!plainText) { > out.write(("
" + filter + " logs
\n" + > "
\n").getBytes());
>     }
>     try {
>       InputStream taskLogReader = 
>         new TaskLog.Reader(taskId, filter, start, end, isCleanup);
>       byte[] b = new byte[65536];
>       int result;
>       while (true) {
>         result = taskLogReader.read(b);
>         if (result > 0) {
>           if (plainText) {
>             out.write(b, 0, result); 
>           } else {
>             HtmlQuoting.quoteHtmlChars(out, b, 0, result);
>           }
>         } else {
>           break;
>         }
>       }
>       taskLogReader.close();
> {code} 
> In the above code, if any exception thrown while reading (taskLogReader.read(b)), taskLogReader will not be closed.
> {code:title=BinaryProtocol$TeeOutputStream.java|borderStyle=solid}
> public void close() throws IOException {
>       flush();
>       file.close();
>       out.close();
>     }
> {code} 
> In the above code, if the file.close() throws any exception out will not be closed.
>  

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