hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From inigo...@apache.org
Subject [hadoop] branch trunk updated: HDFS-14287. DataXceiverServer May Double-Close PeerServer. Contributed by BELUGA BEHR.
Date Mon, 18 Feb 2019 19:00:11 GMT
This is an automated email from the ASF dual-hosted git repository.

inigoiri pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 235e3da  HDFS-14287. DataXceiverServer May Double-Close PeerServer. Contributed by
BELUGA BEHR.
235e3da is described below

commit 235e3da90a4212d0c204afaef09db3408abfab82
Author: Inigo Goiri <inigoiri@apache.org>
AuthorDate: Mon Feb 18 11:00:04 2019 -0800

    HDFS-14287. DataXceiverServer May Double-Close PeerServer. Contributed by BELUGA BEHR.
---
 .../hadoop/hdfs/server/datanode/DataXceiverServer.java | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java
index 8faae63..46cb21e 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java
@@ -244,12 +244,17 @@ class DataXceiverServer implements Runnable {
     }
 
     // Close the server to stop reception of more requests.
+    lock.lock();
     try {
-      peerServer.close();
-      closed = true;
+      if (!closed) {
+        peerServer.close();
+        closed = true;
+      }
     } catch (IOException ie) {
       LOG.warn("{}:DataXceiverServer: close exception",
           datanode.getDisplayName(), ie);
+    } finally {
+      lock.unlock();
     }
 
     // if in restart prep stage, notify peers before closing them.
@@ -270,11 +275,16 @@ class DataXceiverServer implements Runnable {
     assert (datanode.shouldRun == false || datanode.shutdownForUpgrade) :
       "shoudRun should be set to false or restarting should be true"
       + " before killing";
+    lock.lock();
     try {
-      this.peerServer.close();
-      this.closed = true;
+      if (!closed) {
+        peerServer.close();
+        closed = true;
+      }
     } catch (IOException ie) {
       LOG.warn("{}:DataXceiverServer.kill()", datanode.getDisplayName(), ie);
+    } finally {
+      lock.unlock();
     }
   }
 


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


Mime
View raw message