py35: Threads mysteriously exit when warnings logged from exception handler for unhashable exception
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.log |
Fix Released
|
Undecided
|
Zane Bitter |
Bug Description
There's a bug in the traceback module in Python3: https:/
The traceback module will raise a TypeError if any exceptions in the context/cause chain are unhashable. In Python 3, objects of any class that defines an __eq__() method but does not also define a __hash__() method (inheriting one doesn't count) are unhashable. (Explicitly setting __hash__ = None also makes objects of the class unhashable.)
The effect of this bug is Kafkaesque in its monstrosity. Any attempt to log an exception value - whether by using LOG.exception() (or passing exc_info to any log), or just by logging anything at WARNING level or higher from within an exception handler, can trigger the bug. Functions called from within an exception handler count, so the same code that may work when called from outside an exception handler, or from a different exception handler, can mysteriously fail. What's more, the TypeError that is raised will also trigger the bug when logged, since it's __context__ is a pointer to the chain that created the original problem, and is therefore still affected. Even an arbitrary number of levels of catch-all exception handling and logging is insufficient for anything to appear in the log. The effect is as if execution of the thread simply stops for no apparent reason. Good luck debugging that.[1]
I have submitted a pull request to fix this in Python 3.7,[2] and it has been tagged for backporting to Python 3.6. However Python 3.5 is already in security-
[1] *cough* https:/
[2] https:/
Changed in oslo.log: | |
assignee: | nobody → Zane Bitter (zaneb) |
status: | New → In Progress |
Fix proposed to branch: master /review. openstack. org/512853
Review: https:/