Fix method lock release upon exception

Method lock was not released if method execution was ended
with uncaught exception. As a result dead lock could occur.
This commit moves lock release code into finally block

Change-Id: Ie5794c55c9d5a30cd3255ac06e9af944eb732bb1
Closes-Bug: #1392102
This commit is contained in:
Stan Lagun 2014-11-13 02:33:57 +03:00
parent b5bab3ef4b
commit 5cc0280490
1 changed files with 17 additions and 8 deletions

View File

@ -145,14 +145,23 @@ class MuranoDslExecutor(object):
'{0}: Begin execution: {1}'.format(
thread_marker, method_info))
gt = eventlet.spawn(self._invoke_method_implementation_gt, body,
this, params, murano_class, context,
thread_marker)
result = gt.wait()
del self._locks[(method_id, this_id)]
LOG.debug(
"{0}: End execution: {1}".format(thread_marker, method_info))
event.send()
try:
gt = eventlet.spawn(self._invoke_method_implementation_gt, body,
this, params, murano_class, context,
thread_marker)
result = gt.wait()
except Exception as e:
LOG.debug(
"{0}: End execution: {1} with exception {2}".format(
thread_marker, method_info, e))
raise
else:
LOG.debug(
"{0}: End execution: {1}".format(thread_marker, method_info))
finally:
del self._locks[(method_id, this_id)]
event.send()
return result
def _invoke_method_implementation_gt(self, body, this,