diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-11-17 18:26:44 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-11-17 18:26:44 +0000 |
commit | 2b592c7bbe06a8d369063c37f9a49861b14349b2 (patch) | |
tree | a61b76f87dc82ac4b4b426467f3510b6efd97d39 | |
parent | 65f26fbd7cfef5ebe17e4ed6e61010b5f9b1497e (diff) | |
parent | 510345e5adea2bc3a4e4a7c0df65ed6d7c24d0a8 (diff) | |
download | heat-2b592c7bbe06a8d369063c37f9a49861b14349b2.tar.gz |
Merge "Log an error on an uncaught exception in a thread" into stable/kilo
-rw-r--r-- | heat/engine/service.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/heat/engine/service.py b/heat/engine/service.py index 2f1d20021..069d6d3ef 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -116,9 +116,20 @@ class ThreadGroupManager(object): """ if stack_id not in self.groups: self.groups[stack_id] = threadgroup.ThreadGroup() - return self.groups[stack_id].add_thread(self._start_with_trace, - self._serialize_profile_info(), - func, *args, **kwargs) + + def log_exceptions(gt): + try: + gt.wait() + except Exception: + LOG.exception(_LE('Unhandled error in asynchronous task')) + except BaseException: + pass + + th = self.groups[stack_id].add_thread(self._start_with_trace, + self._serialize_profile_info(), + func, *args, **kwargs) + th.link(log_exceptions) + return th def start_with_lock(self, cnxt, stack, engine_id, func, *args, **kwargs): """ |