summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Morin <arnaud.morin@ovhcloud.com>2023-03-03 11:16:56 +0100
committerArnaud Morin <arnaud.morin@ovhcloud.com>2023-03-03 11:24:27 +0100
commitfd2381c723fe805b17aca1f80bfff4738fbe9628 (patch)
tree8ecff8233f3359ab67c4a901204d07cf51187d2f
parent9b1e2dc48e83c225202955c8c7affe5e0bcf6d8b (diff)
downloadoslo-messaging-master.tar.gz
Disable greenthreads for RabbitDriver "listen" connectionsHEAD14.3.0master
When enabling heartbeat_in_pthread, we were restoring the "threading" python library from eventlet to original one in RabbitDriver but we forgot to do the same in AMQPDriverBase (RabbitDriver is subclass of AMQPDriverBase). We also need to use the original "queue" so that queues are not going to use greenthreads as well. Related-bug: #1961402 Related-bug: #1934937 Closes-bug: #2009138 Signed-off-by: Arnaud Morin <arnaud.morin@ovhcloud.com> Change-Id: I34ea0d1381e934297df2f793e0d2594ef8254f00
-rw-r--r--oslo_messaging/_drivers/impl_rabbit.py2
-rw-r--r--oslo_messaging/_utils.py3
2 files changed, 5 insertions, 0 deletions
diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py
index d00a6ab..50e0a66 100644
--- a/oslo_messaging/_drivers/impl_rabbit.py
+++ b/oslo_messaging/_drivers/impl_rabbit.py
@@ -651,6 +651,8 @@ class Connection(object):
# if it was already monkey patched by eventlet/greenlet.
global threading
threading = _utils.stdlib_threading
+ amqpdriver.threading = _utils.stdlib_threading
+ amqpdriver.queue = _utils.stdlib_queue
self.direct_mandatory_flag = driver_conf.direct_mandatory_flag
diff --git a/oslo_messaging/_utils.py b/oslo_messaging/_utils.py
index 0ce1a16..ff7440a 100644
--- a/oslo_messaging/_utils.py
+++ b/oslo_messaging/_utils.py
@@ -14,6 +14,7 @@
# under the License.
import logging
+import queue
import threading
from oslo_utils import eventletutils
@@ -26,12 +27,14 @@ if eventlet and eventletutils.is_monkey_patched("thread"):
# Here we initialize module with the native python threading module
# if it was already monkey patched by eventlet/greenlet.
stdlib_threading = eventlet.patcher.original('threading')
+ stdlib_queue = eventlet.patcher.original('queue')
else:
# Manage the case where we run this driver in a non patched environment
# and where user even so configure the driver to run heartbeat through
# a python thread, if we don't do that when the heartbeat will start
# we will facing an issue by trying to override the threading module.
stdlib_threading = threading
+ stdlib_queue = queue
def version_is_compatible(imp_version, version):