hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject git commit: HADOOP-10404. Some accesses to DomainSocketWatcher#closed are not protected by the lock (cmccabe) (cherry picked from commit 8099de259fb91a29674bf17cb1382c038b707a90)
Date Mon, 06 Oct 2014 21:41:20 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 e5e9cf219 -> c97134d05


HADOOP-10404. Some accesses to DomainSocketWatcher#closed are not protected by the lock (cmccabe)
(cherry picked from commit 8099de259fb91a29674bf17cb1382c038b707a90)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c97134d0
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c97134d0
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c97134d0

Branch: refs/heads/branch-2
Commit: c97134d05442cebd619dfdb5cd8b81ccf1b2a0c4
Parents: e5e9cf2
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Mon Oct 6 14:40:41 2014 -0700
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Mon Oct 6 14:41:14 2014 -0700

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt                | 3 +++
 .../java/org/apache/hadoop/net/unix/DomainSocketWatcher.java   | 6 ++++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/c97134d0/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index bd8488d..f98dcd7 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -15,6 +15,9 @@ Release 2.7.0 - UNRELEASED
 
   BUG FIXES
 
+    HADOOP-10404. Some accesses to DomainSocketWatcher#closed are not protected
+    by the lock (cmccabe)
+
 Release 2.6.0 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c97134d0/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocketWatcher.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocketWatcher.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocketWatcher.java
index 8348aeb..6215e58 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocketWatcher.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocketWatcher.java
@@ -101,6 +101,7 @@ public final class DomainSocketWatcher implements Closeable {
    */
   private class NotificationHandler implements Handler {
     public boolean handle(DomainSocket sock) {
+      lock.lock();
       try {
         if (LOG.isTraceEnabled()) {
           LOG.trace(this + ": NotificationHandler: doing a read on " +
@@ -124,6 +125,8 @@ public final class DomainSocketWatcher implements Closeable {
         }
         closed = true;
         return true;
+      } finally {
+        lock.unlock();
       }
     }
   }
@@ -346,12 +349,15 @@ public final class DomainSocketWatcher implements Closeable {
    * Wake up the DomainSocketWatcher thread.
    */
   private void kick() {
+    lock.lock();
     try {
       notificationSockets[0].getOutputStream().write(0);
     } catch (IOException e) {
       if (!closed) {
         LOG.error(this + ": error writing to notificationSockets[0]", e);
       }
+    } finally {
+      lock.unlock();
     }
   }
 


Mime
View raw message