Monkey patching done after logging

Bug #1163722 reported by Joshua Harlow
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Flavio Percoco
Grizzly
Fix Released
Low
Flavio Percoco

Bug Description

It seems like monkey patching in glance is done after certain modules are already imported and setup. This is due to the monkey patching being done in https://github.com/openstack/glance/blob/master/glance/common/wsgi.py#L208, This can cause problems, one example is the logging module which is setup before this code is executed, and potentially it can be setup with non-monkey-patched modules, which means modules that will block. So say you have a custom logger that does more than the basic logger that comes with python, its usage in glance will cause blocking calls to occur.

Likely the order of monkey patching needs to be reworked??
Looking at nova code they monkey patch very early, instead of later like in glance.
Maybe there are reasons for this in glance?

Revision history for this message
Mark Washenberger (markwash) wrote :

I can't think of a hard reason why we would delay monkey patching. I assume the monkey patching is there just because that's where the bulk of eventlet work is done.

Changed in glance:
status: New → Confirmed
importance: Undecided → Wishlist
Changed in glance:
assignee: nobody → Flavio Percoco Premoli (flaper87)
Changed in glance:
milestone: none → havana-1
Changed in glance:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/26074
Committed: http://github.com/openstack/glance/commit/1c5a4d2bdcc00439b5e351d14f47deebdedcb001
Submitter: Jenkins
Branch: master

commit 1c5a4d2bdcc00439b5e351d14f47deebdedcb001
Author: Flaper Fesp <email address hidden>
Date: Thu Apr 4 11:15:15 2013 +0200

    Call monkey_patch before other modules are loaded

    This patch moves the monkey_patch call into the glance scripts that
    needs libs to be monkey_patched. This seems to be a good practice and
    has given good results for other projects as well.

    This change is needed to avoid loading / initializing modules
    before other libs are patched. For example: logging module.

    Fixes bug 1163722

    Change-Id: Idee486851606d765fb11598967a4f7d56cf46c97

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/28279

Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Alan Pevec (apevec)
Changed in glance:
importance: Wishlist → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (stable/grizzly)

Reviewed: https://review.openstack.org/28279
Committed: http://github.com/openstack/glance/commit/9ce21bd10c463bab16c520cb4ddbadfa1e7fa8d3
Submitter: Jenkins
Branch: stable/grizzly

commit 9ce21bd10c463bab16c520cb4ddbadfa1e7fa8d3
Author: Flaper Fesp <email address hidden>
Date: Thu Apr 4 11:15:15 2013 +0200

    Call monkey_patch before other modules are loaded

    This patch moves the monkey_patch call into the glance scripts that
    needs libs to be monkey_patched. This seems to be a good practice and
    has given good results for other projects as well.

    This change is needed to avoid loading / initializing modules
    before other libs are patched. For example: logging module.

    Fixes bug 1163722

    Change-Id: Idee486851606d765fb11598967a4f7d56cf46c97
    Cherry-picked: 1c5a4d2bdcc00439b5e351d14f47deebdedcb001

Thierry Carrez (ttx)
Changed in glance:
milestone: havana-1 → 2013.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.