summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <ralonsoh@redhat.com>2020-09-30 11:27:31 +0000
committerRodolfo Alonso Hernandez <ralonsoh@redhat.com>2020-10-09 08:57:43 +0000
commitf4d2dd88174e5abdb43dab1958e1798ae177a3a7 (patch)
treea9fbf443f9475a13bb6cd59c72efe657c2c17ea8
parenta2b5fae95f76ce5ee4c2da04ecbff2bbf25a8a8c (diff)
downloadoslo-concurrency-f4d2dd88174e5abdb43dab1958e1798ae177a3a7.tar.gz
Monkey patch original current_thread _active in processutilstrain-em3.30.1
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: I0a2c1e0d8a8cad99d68100d25e88e0d3a2eb8f5c Related-Bug: #1863021 (cherry picked from commit 6533958f5fcec8b1577f56834ea2dc75a4f211e3)
-rw-r--r--oslo_concurrency/processutils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/oslo_concurrency/processutils.py b/oslo_concurrency/processutils.py
index fc815de..85d1283 100644
--- a/oslo_concurrency/processutils.py
+++ b/oslo_concurrency/processutils.py
@@ -56,6 +56,13 @@ if eventlet_patched:
from eventlet.green import subprocess
from eventlet import tpool
+
+ # 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
else:
import subprocess