Skip to content

Commit

Permalink
Monkey patch original current_thread _active
Browse files Browse the repository at this point in the history
Monkey patch the original current_thread to use the up-to-date _active
global variable. This solution is based on that documented at:
eventlet/eventlet#592

Change-Id: Ida548b4bec00530418fd3d7ab254e971af77d3fe
Closes-Bug: #1863021
  • Loading branch information
Corey Bryant committed May 1, 2020
1 parent eb915e2 commit 9f0aae5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cinder/cmd/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@

import eventlet # noqa
eventlet.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active

from oslo_config import cfg
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr
Expand Down
7 changes: 7 additions & 0 deletions cinder/cmd/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
# share the same context.
import eventlet
eventlet.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active

from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging
Expand Down
7 changes: 7 additions & 0 deletions cinder/cmd/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@

import eventlet
eventlet.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active

from oslo_config import cfg
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr
Expand Down
7 changes: 7 additions & 0 deletions cinder/cmd/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active

from oslo_config import cfg
from oslo_log import log as logging
from oslo_privsep import priv_context
Expand Down

0 comments on commit 9f0aae5

Please sign in to comment.