HDFS-9812. Streamer threads leak if failure happens when closing DFSOutputStream. Contributed by Lin Yiqun.
(cherry picked from commit352d299cf8
) (cherry picked from commitfe0009a2bd
)
This commit is contained in:
parent
e768f8b771
commit
7f43eb9547
|
@ -138,6 +138,9 @@ Release 2.7.3 - UNRELEASED
|
|||
HDFS-9865. TestBlockReplacement fails intermittently in trunk
|
||||
(Lin Yiqun via iwasakims)
|
||||
|
||||
HDFS-9812. Streamer threads leak if failure happens when closing
|
||||
DFSOutputStream. (Lin Yiqun via aajisaka)
|
||||
|
||||
Release 2.7.2 - 2016-01-25
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -2262,7 +2262,6 @@ public class DFSOutputStream extends FSOutputSummer
|
|||
flushInternal(); // flush all data to Datanodes
|
||||
// get last block before destroying the streamer
|
||||
ExtendedBlock lastBlock = streamer.getBlock();
|
||||
closeThreads(false);
|
||||
TraceScope scope = Trace.startSpan("completeFile", Sampler.NEVER);
|
||||
try {
|
||||
completeFile(lastBlock);
|
||||
|
@ -2271,7 +2270,12 @@ public class DFSOutputStream extends FSOutputSummer
|
|||
}
|
||||
} catch (ClosedChannelException e) {
|
||||
} finally {
|
||||
setClosed();
|
||||
// Failures may happen when flushing data.
|
||||
// Streamers may keep waiting for the new block information.
|
||||
// Thus need to force closing these threads.
|
||||
// Don't need to call setClosed() because closeThreads(true)
|
||||
// calls setClosed() in the finally block.
|
||||
closeThreads(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue