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 Ayush Saxena
parent 05edfee1f3
commit 408c5c53b1
No known key found for this signature in database
GPG Key ID: D09AE71061AB564D

View File

@ -653,8 +653,12 @@ class BlockSender implements java.io.Closeable {
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);