tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From haris...@apache.org
Subject tez git commit: TEZ-3707. TezSharedExecutor race condition in awaitTermination vs isTerminated. (harishjp)
Date Thu, 04 May 2017 03:56:46 GMT
Repository: tez
Updated Branches:
  refs/heads/master 7b30785bd -> fb7b146ef


TEZ-3707. TezSharedExecutor race condition in awaitTermination vs isTerminated. (harishjp)


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

Branch: refs/heads/master
Commit: fb7b146eff3a3e574f9524131e4d42c2a7de57b0
Parents: 7b30785
Author: Harish JP <harishjp@gmail.com>
Authored: Thu May 4 09:24:39 2017 +0530
Committer: Harish JP <harishjp@gmail.com>
Committed: Thu May 4 09:24:39 2017 +0530

----------------------------------------------------------------------
 .../java/org/apache/tez/common/TezSharedExecutor.java   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/fb7b146e/tez-common/src/main/java/org/apache/tez/common/TezSharedExecutor.java
----------------------------------------------------------------------
diff --git a/tez-common/src/main/java/org/apache/tez/common/TezSharedExecutor.java b/tez-common/src/main/java/org/apache/tez/common/TezSharedExecutor.java
index 93bf3cc..3cc72d5 100644
--- a/tez-common/src/main/java/org/apache/tez/common/TezSharedExecutor.java
+++ b/tez-common/src/main/java/org/apache/tez/common/TezSharedExecutor.java
@@ -277,7 +277,17 @@ public class TezSharedExecutor implements TezExecutors {
 
     @Override
     public boolean isTerminated() {
-      return isShutdown() && futures.isEmpty();
+      if (!isShutdown()) {
+        return false;
+      }
+      // futures should be empty ideally, but there is a corner case where all the futures
are done
+      // but not yet removed from futures map, for that case we check if the future is done.
+      for (ManagedFutureTask<?> future : futures.keySet()) {
+        if (!future.isDone()) {
+          return false;
+        }
+      }
+      return true;
     }
 
     @Override


Mime
View raw message