From 779ae5f1f1cd8328d1423f13550c21fe53b0c803 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 4 May 2020 17:04:40 -0400 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: Ifc6420d927c0ce9e04ff3b3253e81a474591e9bb Closes-Bug: #1863021 (cherry picked from commit 5e9f694a5a8f90c72680acb1181318930f55aa30) (cherry picked from commit 7196cfcb091d66856a1ca0db53816198249196db) --- manila/cmd/api.py | 6 ++++++ manila/cmd/data.py | 6 ++++++ manila/cmd/scheduler.py | 6 ++++++ manila/cmd/share.py | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/manila/cmd/api.py b/manila/cmd/api.py index 42db0501a5..46490e85dd 100644 --- a/manila/cmd/api.py +++ b/manila/cmd/api.py @@ -20,6 +20,12 @@ 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 import sys diff --git a/manila/cmd/data.py b/manila/cmd/data.py index 3eefafbb4f..fe22b2cf22 100644 --- a/manila/cmd/data.py +++ b/manila/cmd/data.py @@ -18,6 +18,12 @@ 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 import sys diff --git a/manila/cmd/scheduler.py b/manila/cmd/scheduler.py index 6c0546742a..457e96d194 100644 --- a/manila/cmd/scheduler.py +++ b/manila/cmd/scheduler.py @@ -20,6 +20,12 @@ 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 import sys diff --git a/manila/cmd/share.py b/manila/cmd/share.py index 5822a2ec54..3b0719b700 100644 --- a/manila/cmd/share.py +++ b/manila/cmd/share.py @@ -19,6 +19,12 @@ 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 import sys