From 3accbf3c80786d162b4f430317c7ad9764a03f77 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Thu, 18 Feb 2016 15:51:58 -0500 Subject: [PATCH] Use Python's threading.semaphore to avoid eventlet deadlocks. Using eventlet.semaphore.Semaphore causes periodic deadlocks for AMQP connection pool establishment (specifically, as the state machine asks for Neutron Router details via the "sync_routers" AMQP call). The state machine worker threads are not monkey-patched green threads (they're native Python threads), so we should just be using a threading.Semaphore here. Change-Id: Id4f370259c0deca4b635319b7302d1c475e7b3fe --- akanda/rug/openstack/common/rpc/amqp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/akanda/rug/openstack/common/rpc/amqp.py b/akanda/rug/openstack/common/rpc/amqp.py index 1cbb20f0..966454df 100644 --- a/akanda/rug/openstack/common/rpc/amqp.py +++ b/akanda/rug/openstack/common/rpc/amqp.py @@ -45,6 +45,7 @@ AMQP, but is deprecated and predates this code. import collections import inspect import sys +import threading import uuid from eventlet import greenpool @@ -107,7 +108,7 @@ class Pool(pools.Pool): self.connection_cls.pool = None -_pool_create_sem = semaphore.Semaphore() +_pool_create_sem = threading.Semaphore() def get_connection_pool(conf, connection_cls):