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

(cherry picked from commit 0f9528b99a)

(cherry picked from commit 38ea1419f6)
(cherry picked from commit 3877166754956bf66a8b1c81440dba2d279a1e03)
This commit is contained in:
Jason Lowe 2014-12-01 22:29:05 +00:00 committed by Vinod Kumar Vavilapalli
parent bfc0a19d6d
commit 2f0a34b5ba
3 changed files with 15 additions and 2 deletions

View File

@ -27,6 +27,9 @@ Release 2.6.1 - 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

View File

@ -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);
}

View File

@ -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;
}