YARN-3760. FSDataOutputStream leak in AggregatedLogFormat.LogWriter.close(). Contributed by Haibo Chen.

(cherry picked from commit c26ccf1adb3a72df3f68e1150b86b813c691203a)
(cherry picked from commit 9d9087a67ad599e678948d5c1036e51cb8cf5e3a)
(cherry picked from commit d77cada182ef805679dc79498d6b6cc6e7f6b6d4)
This commit is contained in:
Junping Du 2017-04-12 09:34:34 -07:00
parent 9eebbcf459
commit c43ee00587

View File

@ -473,14 +473,15 @@ public void append(LogKey logKey, LogValue logValue) throws IOException {
@Override
public void close() {
if (writer != null) {
try {
this.writer.close();
} catch (IOException e) {
LOG.warn("Exception closing writer", e);
try {
if (writer != null) {
writer.close();
}
} catch (Exception e) {
LOG.warn("Exception closing writer", e);
} finally {
IOUtils.closeStream(this.fsDataOStream);
}
IOUtils.closeStream(fsDataOStream);
}
}