Monkey patch original current_thread _active

Monkey patch the original current_thread to use the up-to-date _active
global variable. This solution is based on that documented at:
https://github.com/eventlet/eventlet/issues/592

Change-Id: I95a8d8cf02a0cb923418c0b5655442b8d7bc6b08
Closes-Bug: #1863021
This commit is contained in:
Corey Bryant 2020-03-30 15:14:15 -04:00
parent 2143060833
commit 90146b62c7
3 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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