Custom log handlers lost ability to register event listeners

Bug #1247889 reported by David Peraza
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Zhi Yan Liu

Bug Description

Since this patch was merged, any glance API custom log handlers that required an I/O driven event lost the ability to received such events. I have tracked it down to the monkey patch of thread module on glance/cmd/ entry point. Now, the monkey-patch by it self did not cause this issue it was also the fact the in glance api we allow the eventlet_hub to be set on the glance.common.wsgi module via a call to eventlet.hubs.use_hub. The evenlet hubs documentation clearly explains the use_hub should be done very early in the app initialization before any IO, timers and file descriptors are set:

I would argue that in glance this is done too far in the init and definitely after log handlers are initialized. The solution I propose is to move the call to use_hubs to api entry point right before log.setup('glance') call and remove from glance.common.wsgi. May keep it as a public method on glance.common.wsgi.Server class that can be called from entry point.

This is not an issue with glance registry bacause thread module is not mokey-patched

Any comments one this? Will there be any issue moving the call up?

David Peraza (dperaza)
description: updated
Feilong Wang (flwang)
Changed in glance:
status: New → Triaged
importance: Undecided → Medium
Zhi Yan Liu (lzy-dev)
Changed in glance:
status: Triaged → In Progress
assignee: nobody → Zhi Yan Liu (lzy-dev)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master

Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Submitter: Jenkins
Branch: master

commit 0cd410fc3b4a632177da0d98c7c3b68d26481e71
Author: Zhi Yan Liu <email address hidden>
Date: Tue Jul 15 20:13:11 2014 +0800

    Moving eventlet.hubs.use_hub call up

    Under the design concept of eventlet, we need to call
    eventlet.hubs.use_hub() before the application starts
    doing any I/O. And it makes custom log handlers register
    correct event listeners.

    Closes-bug: 1247889
    Change-Id: I3d43021c8cb6ed630123781f3686d62e5159edfc
    Signed-off-by: Zhi Yan Liu <email address hidden>

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.