← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1784666] Re: The thread local which stores the request context is not green

 

*** This bug is a duplicate of bug 1773102 ***
    https://bugs.launchpad.net/bugs/1773102

Someone said the same in this change:

https://review.openstack.org/#/c/582332/

"""
Hello melanie, I meet the same problem about request-id in log.
I think this bug is similar to cinder bug https://bugs.launchpad.net/cinder/+bug/1743461 as Rikimaru Honjo says.
In his patch, eventlet.monkey_patch() must before import oslo_log (actually before import oslo_context).

In nova, we do eventlet.monkey_patch() in nova/cmd/__init__.py but import oslo_service in nova/__init__.py,
and in oslo_service will import oslo log.

In my environment, I delete the monkey_patch() in nova/cmd/__init__.py and put it to nova/__init__.py before oslo_service.
In this way, the request-id (including the periodic task) will not be replaced by other processes.

I think this maybe more suitable to close bug#1773102.
Tanks.
"""

** Changed in: nova
       Status: New => Triaged

** Also affects: nova/ocata
   Importance: Undecided
       Status: New

** Also affects: nova/pike
   Importance: Undecided
       Status: New

** Also affects: nova/queens
   Importance: Undecided
       Status: New

** No longer affects: nova/ocata

** Changed in: nova/pike
       Status: New => Confirmed

** Changed in: nova/pike
   Importance: Undecided => Medium

** Changed in: nova/queens
       Status: New => Confirmed

** Changed in: nova/queens
   Importance: Undecided => Medium

-- 
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/1784666

Title:
  The thread local which stores the request context is not green

Status in OpenStack Compute (nova):
  Triaged
Status in OpenStack Compute (nova) pike series:
  Confirmed
Status in OpenStack Compute (nova) queens series:
  Confirmed

Bug description:
  nova-compute imports oslo.context before calling monkey_patch():

  (Pdb) bt
    /usr/local/bin/nova-compute(6)<module>()
  -> from nova.cmd.compute import main
    /opt/stack/nova/nova/__init__.py(33)<module>()
  -> import oslo_service  # noqa
    /usr/local/lib/python2.7/dist-packages/oslo_service/__init__.py(17)<module>()
  -> from oslo_log import log as logging
    /usr/local/lib/python2.7/dist-packages/oslo_log/log.py(48)<module>()
  -> from oslo_log import formatters
    /usr/local/lib/python2.7/dist-packages/oslo_log/formatters.py(28)<module>()
  -> from oslo_context import context as context_utils
  > /usr/local/lib/python2.7/dist-packages/oslo_context/context.py(40)<module>()
  -> _request_store = threading.local()

  which makes the global thread-local variable (_request_store) not
  green. So instead of having request context per green thread, we have
  one context for all green threads which is overwritten every time a
  new context is created.

  This is regression from this patch:

  https://review.openstack.org/#/c/434327/

  which imports oslo.service before eventlet

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1784666/+subscriptions


References