You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-issues@hadoop.apache.org by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org> on 2011/06/30 07:18:28 UTC

[jira] [Created] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

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


{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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
                 "<pre>\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

        

[jira] [Assigned] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ravi Teja Ch N V reassigned MAPREDUCE-2631:
-------------------------------------------

    Assignee: Ravi Teja Ch N V
    
> 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
>            Assignee: Ravi Teja Ch N V
>             Fix For: 0.23.0
>
>         Attachments: MAPREDUCE-2631.1.patch, MAPREDUCE-2631.2.patch, MAPREDUCE-2631.3.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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.
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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
     [ 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:
----------------------------------------

    Attachment: MAPREDUCE-2631.patch

> 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Commented] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13100142#comment-13100142 ] 

Ravi Teja Ch N V commented on MAPREDUCE-2631:
---------------------------------------------

The and findbugs testcase failures are not related to this patch.Thanks.

> 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.1.patch, MAPREDUCE-2631.2.patch, MAPREDUCE-2631.3.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
     [ 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:
----------------------------------------

    Status: Open  (was: Patch Available)

> 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.1.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Arun C Murthy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arun C Murthy updated MAPREDUCE-2631:
-------------------------------------

    Status: Open  (was: Patch Available)

Sorry, the patch has gone stale. Can you please rebase? Thanks.


> 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.1.patch, MAPREDUCE-2631.2.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
     [ 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:
----------------------------------------

    Attachment: MAPREDUCE-2631.3.patch

> 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.1.patch, MAPREDUCE-2631.2.patch, MAPREDUCE-2631.3.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Commented] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Todd Lipcon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061651#comment-13061651 ] 

Todd Lipcon commented on MAPREDUCE-2631:
----------------------------------------

- There is at least one hard tab character introduced - please use 2 space indentation.
- please write new unit test files using Junit 4 style instead of inheriting from TestCase

otherwise looks good. thanks

> 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.1.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Commented] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13100118#comment-13100118 ] 

Hadoop QA commented on MAPREDUCE-2631:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12493553/MAPREDUCE-2631.3.patch
  against trunk revision .

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 6 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    -1 findbugs.  The patch appears to introduce 14 new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    -1 core tests.  The patch failed these unit tests:

                  org.apache.hadoop.yarn.server.nodemanager.TestNMAuditLogger

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-mapreduce-client-common.html
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-mapreduce-client-hs.html
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-mapreduce-client-core.html
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-mapreduce-client-app.html
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-mapreduce-client-shuffle.html
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-mapreduce-client-jobclient.html
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-yarn-api.html
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-yarn-server-nodemanager.html
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-yarn-server-resourcemanager.html
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-yarn-server-common.html
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//artifact/trunk/patchprocess/newPatchFindbugsWarningshadoop-yarn-common.html
Console output: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/638//console

This message is automatically generated.

> 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.1.patch, MAPREDUCE-2631.2.patch, MAPREDUCE-2631.3.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Commented] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061994#comment-13061994 ] 

Hadoop QA commented on MAPREDUCE-2631:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12485732/MAPREDUCE-2631.2.patch
  against trunk revision 1144097.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 6 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    -1 core tests.  The patch failed these core unit tests:
                  org.apache.hadoop.cli.TestMRCLI
                  org.apache.hadoop.fs.TestFileSystem

    -1 contrib tests.  The patch failed contrib unit tests.

    +1 system test framework.  The patch passed system test framework compile.

Test results: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/446//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/446//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/446//console

This message is automatically generated.

> 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.1.patch, MAPREDUCE-2631.2.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Commented] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061141#comment-13061141 ] 

Ravi Teja Ch N V commented on MAPREDUCE-2631:
---------------------------------------------

The testcase failures are not related to this patch.

> 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.1.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Commented] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13060550#comment-13060550 ] 

Hadoop QA commented on MAPREDUCE-2631:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12485401/MAPREDUCE-2631.1.patch
  against trunk revision 1143252.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 6 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    -1 core tests.  The patch failed these core unit tests:
                  org.apache.hadoop.cli.TestMRCLI
                  org.apache.hadoop.fs.TestFileSystem

    -1 contrib tests.  The patch failed contrib unit tests.

    +1 system test framework.  The patch passed system test framework compile.

Test results: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/435//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/435//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/435//console

This message is automatically generated.

> 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.1.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Commented] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13063317#comment-13063317 ] 

Ravi Teja Ch N V commented on MAPREDUCE-2631:
---------------------------------------------

The testcase failures are not related to this patch.
This fix is inline with the stream closure pattern in HDFS-1753.

> 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.1.patch, MAPREDUCE-2631.2.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
     [ 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
     [ 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:
----------------------------------------

    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.1.patch, MAPREDUCE-2631.2.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
     [ 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:
----------------------------------------

    Attachment: MAPREDUCE-2631.2.patch

> 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.1.patch, MAPREDUCE-2631.2.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
     [ 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:
----------------------------------------

    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.1.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Commented] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061923#comment-13061923 ] 

Ravi Teja Ch N V commented on MAPREDUCE-2631:
---------------------------------------------

Hi Todd, thanks for pointing it out.
Fixed 1 additional issue, by adding the null check ,avoiding the closing of the stream twice.

> 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.1.patch, MAPREDUCE-2631.2.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Todd Lipcon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Todd Lipcon updated MAPREDUCE-2631:
-----------------------------------

    Status: Open  (was: Patch Available)

> 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.1.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Commented] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058657#comment-13058657 ] 

Hadoop QA commented on MAPREDUCE-2631:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12484872/MAPREDUCE-2631.patch
  against trunk revision 1140942.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 6 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs (version 1.3.9) warnings.

    -1 release audit.  The applied patch generated 3 release audit warnings (more than the trunk's current 2 warnings).

    -1 core tests.  The patch failed these core unit tests:
                  org.apache.hadoop.cli.TestMRCLI
                  org.apache.hadoop.fs.TestFileSystem

    -1 contrib tests.  The patch failed contrib unit tests.

    +1 system test framework.  The patch passed system test framework compile.

Test results: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/434//testReport/
Release audit warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/434//artifact/trunk/patchprocess/patchReleaseAuditProblems.txt
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/434//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/434//console

This message is automatically generated.

> 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
     [ 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:
----------------------------------------

    Status: Patch Available  (was: Open)

Rebased the patch to the latest version.

> 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.1.patch, MAPREDUCE-2631.2.patch, MAPREDUCE-2631.3.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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

        

[jira] [Updated] (MAPREDUCE-2631) Potential resource leaks in BinaryProtocol$TeeOutputStream.java and TaskLogServlet.java

Posted by "Ravi Teja Ch N V (JIRA)" <ji...@apache.org>.
     [ 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:
----------------------------------------

    Attachment: MAPREDUCE-2631.1.patch

Resolved the release audit comments.

> 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.1.patch, 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(("<br><b><u>" + filter + " logs</u></b><br>\n" +
>                  "<pre>\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