The thread local which stores the request context is not green
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Triaged
|
Medium
|
Unassigned | ||
Pike |
Confirmed
|
Medium
|
Unassigned | ||
Queens |
Confirmed
|
Medium
|
Unassigned |
Bug Description
nova-compute imports oslo.context before calling monkey_patch():
(Pdb) bt
/usr/
-> from nova.cmd.compute import main
/opt/
-> import oslo_service # noqa
/usr/
-> from oslo_log import log as logging
/usr/
-> from oslo_log import formatters
/usr/
-> from oslo_context import context as context_utils
> /usr/local/
-> _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:/
which imports oslo.service before eventlet
Changed in nova: | |
importance: | Undecided → Medium |
Someone said the same in this change:
https:/ /review. openstack. org/#/c/ 582332/
""" /bugs.launchpad .net/cinder/ +bug/1743461 as Rikimaru Honjo says. monkey_ patch() must before import oslo_log (actually before import oslo_context).
Hello melanie, I meet the same problem about request-id in log.
I think this bug is similar to cinder bug https:/
In his patch, eventlet.
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.
"""