hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject hadoop git commit: YARN-2905. AggregatedLogsBlock page can infinitely loop if the aggregated log file is corrupted. Contributed by Varun Saxena
Date Mon, 01 Dec 2014 22:30:00 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 2b30fb105 -> 0f9528b99


YARN-2905. AggregatedLogsBlock page can infinitely loop if the aggregated log file is corrupted.
Contributed by Varun Saxena


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0f9528b9
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0f9528b9
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0f9528b9

Branch: refs/heads/trunk
Commit: 0f9528b99addbb0fd9a19d84db22a8c8e934b05f
Parents: 2b30fb1
Author: Jason Lowe <jlowe@apache.org>
Authored: Mon Dec 1 22:29:05 2014 +0000
Committer: Jason Lowe <jlowe@apache.org>
Committed: Mon Dec 1 22:29:05 2014 +0000

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                           |  3 +++
 .../hadoop/yarn/logaggregation/AggregatedLogFormat.java   |  4 ++++
 .../hadoop/yarn/webapp/log/AggregatedLogsBlock.java       | 10 ++++++++--
 3 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0f9528b9/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 22de88b..755763a 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -155,6 +155,9 @@ Release 2.7.0 - UNRELEASED
     YARN-2906. CapacitySchedulerPage shows HTML tags for a queue's Active Users.
     (Jason Lowe via jianhe)
 
+    YARN-2905. AggregatedLogsBlock page can infinitely loop if the aggregated
+    log file is corrupted (Varun Saxena via jlowe)
+
 Release 2.6.0 - 2014-11-18
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0f9528b9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java
index a434ef5..7eebcb3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java
@@ -801,6 +801,10 @@ public class AggregatedLogFormat {
       return currentLogData.skip(n);
     }
 
+    public int read() throws IOException {
+      return currentLogData.read();
+    }
+
     public int read(byte[] buf, int off, int len) throws IOException {
       return currentLogData.read(buf, off, len);
     }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0f9528b9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java
index 3e9f7a2..620d097 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java
@@ -231,8 +231,14 @@ public class AggregatedLogsBlock extends HtmlBlock {
         long totalSkipped = 0;
         while (totalSkipped < start) {
           long ret = logReader.skip(start - totalSkipped);
-          if (ret < 0) {
-            throw new IOException( "Premature EOF from container log");
+          if (ret == 0) {
+            //Read one byte
+            int nextByte = logReader.read();
+            // Check if we have reached EOF
+            if (nextByte == -1) {
+              throw new IOException( "Premature EOF from container log");
+            }
+            ret = 1;
           }
           totalSkipped += ret;
         }


Mime
View raw message