aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wick...@apache.org
Subject git commit: Fix possible deadlock in TaskRunner.collect_updates.
Date Mon, 15 Sep 2014 19:47:23 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 8d8a56c2f -> deedd16bb


Fix possible deadlock in TaskRunner.collect_updates.

Testing Done:
Filed https://issues.apache.org/jira/browse/AURORA-709 to track adding test
coverage for this.

Bugs closed: AURORA-669

Reviewed at https://reviews.apache.org/r/25175/


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

Branch: refs/heads/master
Commit: deedd16bbfbe703ab4d313f5d7ba6839e11013b3
Parents: 8d8a56c
Author: Brian Wickman <wickman@apache.org>
Authored: Mon Sep 15 12:47:18 2014 -0700
Committer: Brian Wickman <wickman@apache.org>
Committed: Mon Sep 15 12:47:18 2014 -0700

----------------------------------------------------------------------
 src/main/python/apache/thermos/core/runner.py | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/deedd16b/src/main/python/apache/thermos/core/runner.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/core/runner.py b/src/main/python/apache/thermos/core/runner.py
index ec4cdb7..31f4071 100644
--- a/src/main/python/apache/thermos/core/runner.py
+++ b/src/main/python/apache/thermos/core/runner.py
@@ -806,20 +806,22 @@ class TaskRunner(object):
       Collects and applies updates from process checkpoint streams.  Returns the number
       of applied process checkpoints.
     """
-    if self.has_active_processes():
-      sleep_interval = self.COORDINATOR_INTERVAL_SLEEP.as_(Time.SECONDS)
-      total_time = 0.0
-      while True:
-        process_updates = self._watcher.select()
-        for process_update in process_updates:
-          self._dispatcher.dispatch(self._state, process_update, self._recovery)
-        if process_updates:
-          return len(process_updates)
-        if timeout and total_time >= timeout:
-          break
-        total_time += sleep_interval
-        self._clock.sleep(sleep_interval)
-    return 0
+    if not self.has_active_processes():
+      return 0
+
+    sleep_interval = self.COORDINATOR_INTERVAL_SLEEP.as_(Time.SECONDS)
+    total_time = 0.0
+
+    while True:
+      process_updates = self._watcher.select()
+      for process_update in process_updates:
+        self._dispatcher.dispatch(self._state, process_update, self._recovery)
+      if process_updates:
+        return len(process_updates)
+      if timeout is not None and total_time >= timeout:
+        return 0
+      total_time += sleep_interval
+      self._clock.sleep(sleep_interval)
 
   def is_terminal(self):
     return TaskRunnerHelper.is_task_terminal(self.task_state())


Mime
View raw message