You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cn...@apache.org on 2026/03/16 18:33:11 UTC

(hadoop) branch branch-3.4 updated: HDFS-4277. SocketTimeoutExceptions over the DataXceiver service of a DN should print the DFSClient ID.

This is an automated email from the ASF dual-hosted git repository.

cnauroth pushed a commit to branch branch-3.4
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.4 by this push:
     new e8a4c36fc1e HDFS-4277. SocketTimeoutExceptions over the DataXceiver service of a DN should print the DFSClient ID.
e8a4c36fc1e is described below

commit e8a4c36fc1eae5fe175040529e44898447770993
Author: Amit Balode <am...@gmail.com>
AuthorDate: Mon Mar 16 17:53:31 2026 +0000

    HDFS-4277. SocketTimeoutExceptions over the DataXceiver service of a DN should print the DFSClient ID.
    
    Include previousOpClientName in the DataXceiver error string so that
    SocketTimeoutException logs (and all other DataXceiver error logs) show
    which DFSClient was connected at the time of the error.
    
    Signed-off-by: Chris Nauroth <cn...@apache.org>
    Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
 .../hadoop/hdfs/server/datanode/DataXceiver.java     | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

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 d948c1caefd..a29fab9734e 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
@@ -303,7 +303,9 @@ public void run() {
     } catch (Throwable t) {
       String s = datanode.getDisplayName() + ":DataXceiver error processing "
           + ((op == null) ? "unknown" : op.name()) + " operation "
-          + " src: " + remoteAddress + " dst: " + localAddress;
+          + " src: " + remoteAddress + " dst: " + localAddress
+          + (previousOpClientName != null
+              ? " clientName: " + previousOpClientName : "");
       if (op == Op.WRITE_BLOCK && t instanceof ReplicaAlreadyExistsException) {
         // For WRITE_BLOCK, it is okay if the replica already exists since
         // client and replication may write the same block to the same datanode
@@ -645,8 +647,8 @@ public void readBlock(final ExtendedBlock block,
       datanode.metrics.incrTotalReadTime(TimeUnit.NANOSECONDS.toMillis(durationInNS));
       DFSUtil.addTransferRateMetric(datanode.metrics, read, durationInNS);
     } catch ( SocketException ignored ) {
-      LOG.trace("{}:Ignoring exception while serving {} to {}",
-          dnR, block, remoteAddress, ignored);
+      LOG.trace("{}:Ignoring exception while serving {} to {} for client {}",
+          dnR, block, remoteAddress, clientName, ignored);
       // Its ok for remote side to close the connection anytime.
       datanode.metrics.incrBlocksRead();
       IOUtils.closeStream(out);
@@ -655,8 +657,8 @@ public void readBlock(final ExtendedBlock block,
        * Earlier version shutdown() datanode if there is disk error.
        */
       if (!(ioe instanceof SocketTimeoutException)) {
-        LOG.warn("{}:Got exception while serving {} to {}",
-            dnR, block, remoteAddress, ioe);
+        LOG.warn("{}:Got exception while serving {} to {} for client {}",
+            dnR, block, remoteAddress, clientName, ioe);
         incrDatanodeNetworkErrors();
       }
       // Normally the client reports a bad block to the NN. However if the
@@ -949,8 +951,8 @@ public void writeBlock(final ExtendedBlock block,
         size = block.getNumBytes();
       }
     } catch (IOException ioe) {
-      LOG.info("opWriteBlock {} received exception {}",
-          block, ioe.toString());
+      LOG.info("opWriteBlock {} received exception {} from client {}",
+          block, ioe.toString(), clientname);
       incrDatanodeNetworkErrors();
       throw ioe;
     } finally {
@@ -991,8 +993,8 @@ public void transferBlock(final ExtendedBlock blk,
           targetStorageTypes, targetStorageIds, clientName);
       writeResponse(Status.SUCCESS, null, out);
     } catch (IOException ioe) {
-      LOG.info("transferBlock {} received exception {}",
-          blk, ioe.toString());
+      LOG.info("transferBlock {} received exception {} from client {}",
+          blk, ioe.toString(), clientName);
       incrDatanodeNetworkErrors();
       throw ioe;
     } finally {


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org