Always delete exc_info tuple, even if reply fails
Avoid any possible references to exc_info tuple by ensuring we delete it in a finally block, so that even if replying or logging fails somehow the prior exception is always deleted correctly. Change-Id: Id0e5099b9b38b1803bb4514f7cf3deae760d5ac3
This commit is contained in:
parent
5b75f39676
commit
0774b5ceba
@ -145,13 +145,15 @@ class RPCDispatcher(dispatcher.DispatcherBase):
|
|||||||
# by another exception raise by a log handler during
|
# by another exception raise by a log handler during
|
||||||
# LOG.exception(). So keep a copy and delete it later.
|
# LOG.exception(). So keep a copy and delete it later.
|
||||||
exc_info = sys.exc_info()
|
exc_info = sys.exc_info()
|
||||||
LOG.error(_LE('Exception during message handling: %s'), e,
|
try:
|
||||||
exc_info=exc_info)
|
LOG.error(_LE('Exception during message handling: %s'), e,
|
||||||
incoming.reply(failure=exc_info)
|
exc_info=exc_info)
|
||||||
# NOTE(dhellmann): Remove circular object reference
|
incoming.reply(failure=exc_info)
|
||||||
# between the current stack frame and the traceback in
|
finally:
|
||||||
# exc_info.
|
# NOTE(dhellmann): Remove circular object reference
|
||||||
del exc_info
|
# between the current stack frame and the traceback in
|
||||||
|
# exc_info.
|
||||||
|
del exc_info
|
||||||
|
|
||||||
def _dispatch(self, ctxt, message):
|
def _dispatch(self, ctxt, message):
|
||||||
"""Dispatch an RPC message to the appropriate endpoint method.
|
"""Dispatch an RPC message to the appropriate endpoint method.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user