summaryrefslogtreecommitdiff
path: root/heat
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2017-07-10 13:48:01 -0400
committerRico Lin <rico.lin@easystack.cn>2017-07-27 01:52:48 +0000
commitb4be5f7d8a8ee3a06651cab9f828d541f0f5e220 (patch)
treeb6d8f821d08fbb02f5f6554803445329d7ad0d0d /heat
parent5034bc10afb736eedca0cb4e0503652711008e23 (diff)
downloadheat-b4be5f7d8a8ee3a06651cab9f828d541f0f5e220.tar.gz
Log unhandled exceptions in worker
RPC calls to the worker use 'cast', so nothing is listening to find out the result. If an exception occurs we will never hear about it. This change logs such unhandled exceptions as errors. Change-Id: I51365a9dee8fd4eff85e77d3e42bf33be814a22c Partial-Bug: #1703043 (cherry picked from commit 33a16aa7a808f3f1a9fc9faf2a8b1017a8bcbbbe)
Diffstat (limited to 'heat')
-rw-r--r--heat/engine/worker.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/heat/engine/worker.py b/heat/engine/worker.py
index a72fa73e6..ba008f694 100644
--- a/heat/engine/worker.py
+++ b/heat/engine/worker.py
@@ -14,9 +14,11 @@
# limitations under the License.
import eventlet.queue
+import functools
from oslo_log import log as logging
import oslo_messaging
+from oslo_utils import excutils
from oslo_utils import uuidutils
from osprofiler import profiler
@@ -38,6 +40,18 @@ LOG = logging.getLogger(__name__)
CANCEL_RETRIES = 3
+def log_exceptions(func):
+ @functools.wraps(func)
+ def exception_wrapper(*args, **kwargs):
+ try:
+ return func(*args, **kwargs)
+ except Exception:
+ with excutils.save_and_reraise_exception():
+ LOG.exception('Unhandled exception in %s', func.__name__)
+
+ return exception_wrapper
+
+
@profiler.trace_cls("rpc")
class WorkerService(object):
"""Service that has 'worker' actor in convergence.
@@ -150,6 +164,7 @@ class WorkerService(object):
stack)
@context.request_context
+ @log_exceptions
def check_resource(self, cnxt, resource_id, current_traversal, data,
is_update, adopt_stack_data):
"""Process a node in the dependency graph.
@@ -183,6 +198,7 @@ class WorkerService(object):
stack.id, msg_queue)
@context.request_context
+ @log_exceptions
def cancel_check_resource(self, cnxt, stack_id):
"""Cancel check_resource for given stack.