Browse Source

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
tags/20.0.0.0b3
Corey Bryant 3 months ago
parent
commit
90146b62c7
3 changed files with 21 additions and 0 deletions
  1. +7
    -0
      glance/cmd/api.py
  2. +7
    -0
      glance/cmd/registry.py
  3. +7
    -0
      glance/cmd/scrubber.py

+ 7
- 0
glance/cmd/api.py 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



+ 7
- 0
glance/cmd/registry.py 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



+ 7
- 0
glance/cmd/scrubber.py 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


Loading…
Cancel
Save