Repository: ambari Updated Branches: refs/heads/trunk af6ba590d -> b722ffa6f
AMBARI-19775. ActionQueue thread may exit due to IOError in statusCommandResultQueue.empty(). (Attila Doroszlai via stoader) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b722ffa6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b722ffa6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b722ffa6 Branch: refs/heads/trunk Commit: b722ffa6f612685096c0c528264fdf1ae86b5d64 Parents: af6ba59 Author: Attila Doroszlai <adorosz...@hortonworks.com> Authored: Mon Jan 30 14:58:47 2017 +0100 Committer: Toader, Sebastian <stoa...@hortonworks.com> Committed: Mon Jan 30 14:58:47 2017 +0100 ---------------------------------------------------------------------- .../src/main/python/ambari_agent/ActionQueue.py | 28 +++++++++++--------- 1 file changed, 16 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/b722ffa6/ambari-agent/src/main/python/ambari_agent/ActionQueue.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py index 18d7c2a..8514a88 100644 --- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py +++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py @@ -212,18 +212,22 @@ class ActionQueue(threading.Thread): pass def processStatusCommandResultQueueSafeEmpty(self): - while not self.statusCommandResultQueue.empty(): - try: - result = self.statusCommandResultQueue.get(False) - self.process_status_command_result(result) - except Queue.Empty: - pass - except IOError: - # on race condition in multiprocessing.Queue if get/put and thread kill are executed at the same time. - # During queue.close IOError will be thrown (this prevents from permanently dead-locked get). - pass - except UnicodeDecodeError: - pass + try: + while not self.statusCommandResultQueue.empty(): + try: + result = self.statusCommandResultQueue.get(False) + self.process_status_command_result(result) + except Queue.Empty: + pass + except IOError: + # on race condition in multiprocessing.Queue if get/put and thread kill are executed at the same time. + # During queue.close IOError will be thrown (this prevents from permanently dead-locked get). + pass + except UnicodeDecodeError: + pass + except IOError: + # queue.empty() may also throw IOError + pass def createCommandHandle(self, command): if command.has_key('__handle'):