YARN-9336. JobHistoryServer leaks CLOSE_WAIT tcp connections when using LogAggregationIndexedFileController. Contributed by Tarun Parimi.

This commit is contained in:
Rohith Sharma K S 2019-03-12 20:57:27 +05:30
parent daf4660eeb
commit c24af4b0d6

View File

@ -202,7 +202,7 @@ public class IndexedFileAggregatedLogsBlock extends LogAggregationHtmlBlock {
Decompressor decompressor = compressName.getDecompressor(); Decompressor decompressor = compressName.getDecompressor();
FileContext fileContext = FileContext.getFileContext( FileContext fileContext = FileContext.getFileContext(
thisNodeFile.getPath().toUri(), conf); thisNodeFile.getPath().toUri(), conf);
FSDataInputStream fsin = fileContext.open(thisNodeFile.getPath()); try (FSDataInputStream fsin = fileContext.open(thisNodeFile.getPath())) {
int bufferSize = 65536; int bufferSize = 65536;
for (IndexedFileLogMeta candidate : candidates) { for (IndexedFileLogMeta candidate : candidates) {
if (candidate.getLastModifiedTime() < startTime if (candidate.getLastModifiedTime() < startTime
@ -219,9 +219,8 @@ public class IndexedFileAggregatedLogsBlock extends LogAggregationHtmlBlock {
long logLength = candidate.getFileSize(); long logLength = candidate.getFileSize();
html.pre().__("\n\n").__(); html.pre().__("\n\n").__();
html.p().__("Log Type: " + candidate.getFileName()).__(); html.p().__("Log Type: " + candidate.getFileName()).__();
html.p().__( html.p().__("Log Upload Time: " +
"Log Upload Time: " + Times.format(candidate.getLastModifiedTime())) Times.format(candidate.getLastModifiedTime())).__();
.__();
html.p().__("Log Length: " + Long.toString(logLength)).__(); html.p().__("Log Length: " + Long.toString(logLength)).__();
long[] range = checkParseRange(html, start, end, startTime, endTime, long[] range = checkParseRange(html, start, end, startTime, endTime,
@ -236,6 +235,7 @@ public class IndexedFileAggregatedLogsBlock extends LogAggregationHtmlBlock {
IOUtils.closeQuietly(in); IOUtils.closeQuietly(in);
} }
} }
}
return foundLog; return foundLog;
} }