HDFS-16897. Fix abundant Broken pipe exception in BlockSender (#5329). Contributed by fanluo.

Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
fanluoo 2023-04-29 19:54:56 +08:00 committed by GitHub
parent 70c0aa342e
commit 1a2cd965a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -654,8 +654,12 @@ private int sendPacket(ByteBuffer pkt, int maxChunks, OutputStream out,
if (ioem.startsWith(EIO_ERROR)) { if (ioem.startsWith(EIO_ERROR)) {
throw new DiskFileCorruptException("A disk IO error occurred", e); throw new DiskFileCorruptException("A disk IO error occurred", e);
} }
String causeMessage = e.getCause() != null ? e.getCause().getMessage() : "";
causeMessage = causeMessage != null ? causeMessage : "";
if (!ioem.startsWith("Broken pipe") if (!ioem.startsWith("Broken pipe")
&& !ioem.startsWith("Connection reset")) { && !ioem.startsWith("Connection reset")
&& !causeMessage.startsWith("Broken pipe")
&& !causeMessage.startsWith("Connection reset")) {
LOG.error("BlockSender.sendChunks() exception: ", e); LOG.error("BlockSender.sendChunks() exception: ", e);
datanode.getBlockScanner().markSuspectBlock( datanode.getBlockScanner().markSuspectBlock(
ris.getVolumeRef().getVolume().getStorageID(), block); ris.getVolumeRef().getVolume().getStorageID(), block);