From 71888358907279e11410cec6b82a6b5560dc3736 Mon Sep 17 00:00:00 2001 From: TommyLike Date: Wed, 6 Jun 2018 13:59:36 +0800 Subject: [PATCH] Add warning output if failed to rebuild exception when deserialize In some specific cases, the middleware would fail to rebuild the original exception, see bug [1] below. Adding this output may help locate the root cause quickly. [1]: https://bugs.launchpad.net/cinder/+bug/1728826 Change-Id: Ia9304bda4e515812b146885f830e70f28a285f2d --- oslo_messaging/_drivers/common.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oslo_messaging/_drivers/common.py b/oslo_messaging/_drivers/common.py index d46400f47..d4b20c447 100644 --- a/oslo_messaging/_drivers/common.py +++ b/oslo_messaging/_drivers/common.py @@ -27,7 +27,7 @@ import six import oslo_messaging from oslo_messaging._i18n import _ -from oslo_messaging._i18n import _LE +from oslo_messaging._i18n import _LE, _LW from oslo_messaging import _utils as utils LOG = logging.getLogger(__name__) @@ -229,7 +229,9 @@ def deserialize_remote_exception(data, allowed_remote_exmods): raise TypeError("Can only deserialize Exceptions") failure = klass(*failure.get('args', []), **failure.get('kwargs', {})) - except (AttributeError, TypeError, ImportError): + except (AttributeError, TypeError, ImportError) as error: + LOG.warning(_LW("Failed to rebuild remote exception due to error: %s"), + six.text_type(error)) return oslo_messaging.RemoteError(name, failure.get('message'), trace) ex_type = type(failure)