HDFS-5671. Fix socket leak in DFSInputStream#getBlockReader. Contributed by JamesLi
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1554553 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
460ac8cb50
commit
97e881b955
|
@ -1025,6 +1025,8 @@ Release 2.3.0 - UNRELEASED
|
|||
HDFS-5582. hdfs getconf -excludeFile or -includeFile always failed (sathish
|
||||
via cmccabe)
|
||||
|
||||
HDFS-5671. Fix socket leak in DFSInputStream#getBlockReader. (JamesLi via umamahesh)
|
||||
|
||||
Release 2.2.0 - 2013-10-13
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -1188,11 +1188,21 @@ implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead,
|
|||
}
|
||||
// Try to create a new remote peer.
|
||||
Peer peer = newTcpPeer(dnAddr);
|
||||
return BlockReaderFactory.newBlockReader(
|
||||
dfsClient.getConf(), file, block, blockToken, startOffset,
|
||||
len, verifyChecksum, clientName, peer, chosenNode,
|
||||
dsFactory, peerCache, fileInputStreamCache, false,
|
||||
curCachingStrategy);
|
||||
try {
|
||||
reader = BlockReaderFactory.newBlockReader(dfsClient.getConf(), file,
|
||||
block, blockToken, startOffset, len, verifyChecksum, clientName,
|
||||
peer, chosenNode, dsFactory, peerCache, fileInputStreamCache, false,
|
||||
curCachingStrategy);
|
||||
return reader;
|
||||
} catch (IOException ex) {
|
||||
DFSClient.LOG.debug(
|
||||
"Exception while getting block reader, closing stale " + peer, ex);
|
||||
throw ex;
|
||||
} finally {
|
||||
if (reader == null) {
|
||||
IOUtils.closeQuietly(peer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue