Repository: incubator-reef
Updated Branches:
  refs/heads/master c9e1bf9b3 -> 9ebba41b2


[REEF-539] Ignore unknown tasks in CommunicationGroupDriverImpl.failTask()

`CommunicationGroupDriverImpl.failTask()` now ignores tasks that aren't
part of the communication group. This resolves an issue where a
`NullPointerException` is thrown when the wrong communication group
tries to handle a task.

JIRA:
  [REEF-539](https://issues.apache.org/jira/browse/REEF-539)

Pull Request:
  This closes #322


Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/9ebba41b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/9ebba41b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/9ebba41b

Branch: refs/heads/master
Commit: 9ebba41b2043e5c88405970988918f9e16f45640
Parents: c9e1bf9
Author: Ignacio Cano <[email protected]>
Authored: Thu Jul 30 14:21:41 2015 -0700
Committer: Markus Weimer <[email protected]>
Committed: Fri Jul 31 12:42:24 2015 -0700

----------------------------------------------------------------------
 .../group/impl/driver/CommunicationGroupDriverImpl.java      | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/9ebba41b/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/CommunicationGroupDriverImpl.java
----------------------------------------------------------------------
diff --git 
a/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/CommunicationGroupDriverImpl.java
 
b/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/CommunicationGroupDriverImpl.java
index 91d6564..ffc0f20 100644
--- 
a/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/CommunicationGroupDriverImpl.java
+++ 
b/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/CommunicationGroupDriverImpl.java
@@ -317,6 +317,14 @@ public class CommunicationGroupDriverImpl implements 
CommunicationGroupDriver {
     LOG.fine(getQualifiedName() + "Got failed Task: " + id);
     synchronized (yetToRunLock) {
       LOG.finest(getQualifiedName() + "Acquired yetToRunLock");
+      // maybe the task does not belong to this communication group.
+      // if it doesn't, we return, it should belong to other group
+      // which will handle its failure
+      if (!perTaskState.containsKey(id)) {
+        LOG.fine(getQualifiedName()
+            + " does not have this task, another communicationGroup must have 
it");
+        return;
+      }
       while (cantFailTask(id)) {
         LOG.finest(getQualifiedName() + "Need to wait for it run");
         try {

Reply via email to