HDFS-15199. NPE in BlockSender. Contributed by Ayush Saxena.

This commit is contained in:
Surendra Singh Lilhore 2020-02-28 18:33:06 +05:30
parent ce6614565e
commit 64eb5b2709
1 changed files with 15 additions and 12 deletions

View File

@ -664,18 +664,21 @@ class BlockSender implements java.io.Closeable {
* It was done here because the NIO throws an IOException for EPIPE. * It was done here because the NIO throws an IOException for EPIPE.
*/ */
String ioem = e.getMessage(); String ioem = e.getMessage();
/* if (ioem != null) {
* If we got an EIO when reading files or transferTo the client socket, /*
* it's very likely caused by bad disk track or other file corruptions. * If we got an EIO when reading files or transferTo the client
*/ * socket, it's very likely caused by bad disk track or other file
if (ioem.startsWith(EIO_ERROR)) { * corruptions.
throw new DiskFileCorruptException("A disk IO error occurred", e); */
} if (ioem.startsWith(EIO_ERROR)) {
if (!ioem.startsWith("Broken pipe") && !ioem.startsWith("Connection reset")) { throw new DiskFileCorruptException("A disk IO error occurred", e);
LOG.error("BlockSender.sendChunks() exception: ", e); }
datanode.getBlockScanner().markSuspectBlock( if (!ioem.startsWith("Broken pipe")
ris.getVolumeRef().getVolume().getStorageID(), && !ioem.startsWith("Connection reset")) {
block); LOG.error("BlockSender.sendChunks() exception: ", e);
datanode.getBlockScanner().markSuspectBlock(
ris.getVolumeRef().getVolume().getStorageID(), block);
}
} }
} }
throw ioeToSocketException(e); throw ioeToSocketException(e);