diff --git a/glance/cmd/api.py b/glance/cmd/api.py index 462273e0e5..dfb08ec6b1 100644 --- a/glance/cmd/api.py +++ b/glance/cmd/api.py @@ -39,6 +39,13 @@ if os.name == 'nt': else: eventlet.patcher.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 +orig_threading.current_thread.__globals__['_active'] = threading._active + from oslo_reports import guru_meditation_report as gmr from oslo_utils import encodeutils diff --git a/glance/cmd/registry.py b/glance/cmd/registry.py index 662e83da84..40b6ce2abc 100644 --- a/glance/cmd/registry.py +++ b/glance/cmd/registry.py @@ -39,6 +39,13 @@ if os.name == 'nt': else: eventlet.patcher.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 +orig_threading.current_thread.__globals__['_active'] = threading._active + from oslo_reports import guru_meditation_report as gmr from oslo_utils import encodeutils diff --git a/glance/cmd/scrubber.py b/glance/cmd/scrubber.py index f27c854ad3..0f49b00502 100644 --- a/glance/cmd/scrubber.py +++ b/glance/cmd/scrubber.py @@ -37,6 +37,13 @@ if os.name == 'nt': else: eventlet.patcher.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 +orig_threading.current_thread.__globals__['_active'] = threading._active + import subprocess # If ../glance/__init__.py exists, add ../ to Python search path, so that