Repository: ambari Updated Branches: refs/heads/trunk d69b58234 -> db9e72912
AMBARI-20582 Single process executor possibly can cause deadlock. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/db9e7291 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/db9e7291 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/db9e7291 Branch: refs/heads/trunk Commit: db9e72912e6948352bc15f3e146f96631e1157c8 Parents: d69b582 Author: Eugene Chekanskiy <[email protected]> Authored: Mon Mar 27 18:24:44 2017 +0300 Committer: Eugene Chekanskiy <[email protected]> Committed: Mon Mar 27 18:24:44 2017 +0300 ---------------------------------------------------------------------- .../src/main/python/ambari_agent/StatusCommandsExecutor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/db9e7291/ambari-agent/src/main/python/ambari_agent/StatusCommandsExecutor.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/StatusCommandsExecutor.py b/ambari-agent/src/main/python/ambari_agent/StatusCommandsExecutor.py index eaa24c2..04a3e85 100644 --- a/ambari-agent/src/main/python/ambari_agent/StatusCommandsExecutor.py +++ b/ambari-agent/src/main/python/ambari_agent/StatusCommandsExecutor.py @@ -52,8 +52,11 @@ class SingleProcessStatusCommandsExecutor(StatusCommandsExecutor): self.need_relaunch = False def put_commands(self, commands): - while not self.statusCommandQueue.empty(): - self.statusCommandQueue.get() + with self.statusCommandQueue.mutex: + qlen = len(self.statusCommandQueue.queue) + if qlen: + logger.info("Removing %s stale status commands from queue", qlen) + self.statusCommandQueue.queue.clear() for command in commands: logger.info("Adding " + command['commandType'] + " for component " + \
