Copying slightly modified Alexander's explanation from origin bug to Mirantis Openstack:
Python logging used in oslo.log consists of a bunch of logger objects for different modules.
Any logger object calls handle() method of every logging handler registered in the logger or any of it's parents.
All Handlers are derived from python logging.Handler class.
logging.Handler.handle() implemented as a critical section using a lock.
The lock used in logging.Handler.handle() is created by logging.Handler.createLock().
The lock is threading.RLock() which is reentrant allowing owner thread to attempt aquiring lock without blocking.
Thread is identified using _get_ident() call which is patched by eventlet.
If we patch threading late, _get_ident() gets patched and internals of RLock don't, causing deadlocks on greenthread switch.
David,
Copying slightly modified Alexander's explanation from origin bug to Mirantis Openstack:
Python logging used in oslo.log consists of a bunch of logger objects for different modules. Handler. handle( ) implemented as a critical section using a lock. Handler. handle( ) is created by logging. Handler. createLock( ).
Any logger object calls handle() method of every logging handler registered in the logger or any of it's parents.
All Handlers are derived from python logging.Handler class.
logging.
The lock used in logging.
The lock is threading.RLock() which is reentrant allowing owner thread to attempt aquiring lock without blocking.
Thread is identified using _get_ident() call which is patched by eventlet.
If we patch threading late, _get_ident() gets patched and internals of RLock don't, causing deadlocks on greenthread switch.