Merge. HDFS-5671. Fix socket leak in DFSInputStream#getBlockReader. Contributed by JamesLi
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1554556 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5f698ffb57
commit
1df8cb9ce0
|
@ -438,6 +438,8 @@ Release 2.3.0 - UNRELEASED
|
||||||
HDFS-5582. hdfs getconf -excludeFile or -includeFile always failed (sathish
|
HDFS-5582. hdfs getconf -excludeFile or -includeFile always failed (sathish
|
||||||
via cmccabe)
|
via cmccabe)
|
||||||
|
|
||||||
|
HDFS-5671. Fix socket leak in DFSInputStream#getBlockReader. (JamesLi via umamahesh)
|
||||||
|
|
||||||
Release 2.2.0 - 2013-10-13
|
Release 2.2.0 - 2013-10-13
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -1188,11 +1188,21 @@ implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead,
|
||||||
}
|
}
|
||||||
// Try to create a new remote peer.
|
// Try to create a new remote peer.
|
||||||
Peer peer = newTcpPeer(dnAddr);
|
Peer peer = newTcpPeer(dnAddr);
|
||||||
return BlockReaderFactory.newBlockReader(
|
try {
|
||||||
dfsClient.getConf(), file, block, blockToken, startOffset,
|
reader = BlockReaderFactory.newBlockReader(dfsClient.getConf(), file,
|
||||||
len, verifyChecksum, clientName, peer, chosenNode,
|
block, blockToken, startOffset, len, verifyChecksum, clientName,
|
||||||
dsFactory, peerCache, fileInputStreamCache, false,
|
peer, chosenNode, dsFactory, peerCache, fileInputStreamCache, false,
|
||||||
curCachingStrategy);
|
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