yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #27149
[Bug 1154140] Re: Add excutils.save_and_reraise_exception()
** Changed in: nova
Status: Incomplete => Invalid
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1154140
Title:
Add excutils.save_and_reraise_exception()
Status in OpenStack Compute (Nova):
Invalid
Status in Messaging API for OpenStack:
Invalid
Bug description:
See https://review.openstack.org/23894
|--LOG.exception()
| |--LoggerAdapter.exception():logging/__init()__
| |--self.logger.error()
| |--self._log()
| |--self.handle()
| |--self.callHandlers()
| |--hdlr.handle()
| |--Handler.handle():handlers.py
| |--self.emit()
| |--self.socket.sendto()
| |--GreenSocket.sendto():eventlet/greenio.py
| |--trampoline():hubs/__init__.py
| |--hub.switch()
| |--BaseHub.switch():hub.py
| |-- clear_sys_exc_info()
When you're using syslog logging, LOG.exception() can cause
sys.exc_info() to be cleared
So if you do e.g.
except Exception:
LOG.exception(_('in looping call'))
done.send_exception(*sys.exc_info())
return
then you'll find that (with syslog enabled) the second reference to
sys.exc_info() won't work
Basically, any time you make a call that can result in a greenlet
context switch you can find sys.exc_info() has been cleared
The really nasty thing is this only happens with syslog so you don't
find it under normal testing
I'm thinking we need something like:
with excutils.save_and_restore_exception():
LOG.exception(...)
ctxt.reply(...)
which would be equivalent to:
except Exception:
try:
with excutils.save_and_reraise_exception():
LOG.exception(...)
except Exception:
ctxt.reply(...)
however, I'm not sure there's a way of restoring sys.exc_info() that
will work with python 3 - AFAIK, in python3 exc_info is only valid
during an exception handler
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1154140/+subscriptions