YARN-2905. AggregatedLogsBlock page can infinitely loop if the aggregated log file is corrupted. Contributed by Varun Saxena
(cherry picked from commit 0f9528b99a
)
This commit is contained in:
parent
2bdef5697b
commit
38ea1419f6
|
@ -128,6 +128,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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue