From 294d0f6f6a90926f23cbcf8006cbc893bdb488e6 Mon Sep 17 00:00:00 2001 From: cnauroth Date: Thu, 17 Dec 2015 14:04:45 -0800 Subject: [PATCH] HDFS-9572. Prevent DataNode log spam if a client connects on the data transfer port but sends no data. Contributed by Chris Nauroth (cherry picked from commit 03bab8dea163a9ee45d09d2a0483d45cf6fe57c9) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hdfs/server/datanode/DataXceiver.java | 19 ++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 844f867d959..db4f5652830 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1648,6 +1648,9 @@ Release 2.8.0 - UNRELEASED HDFS-9515. NPE when MiniDFSCluster#shutdown is invoked on uninitialized reference. (Wei-Chiu Chuang via Arpit Agarwal) + HDFS-9572. Prevent DataNode log spam if a client connects on the data + transfer port but sends no data. (cnauroth) + Release 2.7.3 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java index 8220d6c07a0..f9c68cdde2c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java @@ -233,18 +233,15 @@ class DataXceiver extends Receiver implements Runnable { } catch (InterruptedIOException ignored) { // Time out while we wait for client rpc break; - } catch (IOException err) { - // Since we optimistically expect the next op, it's quite normal to get EOF here. - if (opsProcessed > 0 && - (err instanceof EOFException || err instanceof ClosedChannelException)) { - if (LOG.isDebugEnabled()) { - LOG.debug("Cached " + peer + " closing after " + opsProcessed + " ops"); - } - } else { - incrDatanodeNetworkErrors(); - throw err; - } + } catch (EOFException | ClosedChannelException e) { + // Since we optimistically expect the next op, it's quite normal to + // get EOF here. + LOG.debug("Cached {} closing after {} ops. " + + "This message is usually benign.", peer, opsProcessed); break; + } catch (IOException err) { + incrDatanodeNetworkErrors(); + throw err; } // restore normal timeout