From e03968b46c19cb416d99de02bc050ec0bf372463 Mon Sep 17 00:00:00 2001 From: Chris MacNaughton Date: Wed, 6 May 2020 08:16:15 +0200 Subject: [PATCH] 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: Ia2dd231f4b8cb6f8876cf54671529095a9d11fc6 Closes-Bug: #1863021 --- vmware_nsx/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vmware_nsx/__init__.py b/vmware_nsx/__init__.py index 99c772c822..02fb2b0623 100644 --- a/vmware_nsx/__init__.py +++ b/vmware_nsx/__init__.py @@ -14,6 +14,13 @@ from neutron.common import eventlet_utils eventlet_utils.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 # noqa +import threading # noqa +orig_threading.current_thread.__globals__['_active'] = threading._active + import os # noqa NSX_EXT_PATH = os.path.join(os.path.dirname(__file__), 'extensions')