summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOscar Huang <xiwhuang@ebaysf.com>2015-07-15 09:48:25 +0000
committerOscar Huang <xiwhuang@ebaysf.com>2015-07-15 10:29:24 +0000
commitd5780ad357b640c610618e5b2f3ddd888073450d (patch)
tree6fac8c88b8f74d1d27919ff83f37580e249a4e03
parent8a9b5d44ae8d59591dd0e7a8e75bb02ade4b02d7 (diff)
downloadoslo-messaging-d5780ad357b640c610618e5b2f3ddd888073450d.tar.gz
Fix amqp connection pool leak in ConnectionContext
When failed in connection.reset(), the current code simply discards the broken connection, without returning a new one to the pool, nor adjust pool counter. It results in a connection leak and eventually blocks the thread. It is fixed by returning a new connection into the pool. Change-Id: I2b2c23def718d8f2409f9fc415441ac88d40f5b9 Closes-Bug: #1474698
-rw-r--r--oslo_messaging/_drivers/amqp.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/oslo_messaging/_drivers/amqp.py b/oslo_messaging/_drivers/amqp.py
index 7fd3d37..4a4e3c1 100644
--- a/oslo_messaging/_drivers/amqp.py
+++ b/oslo_messaging/_drivers/amqp.py
@@ -153,7 +153,8 @@ class ConnectionContext(rpc_common.Connection):
self.connection.close()
except Exception:
pass
- else:
+ self.connection = self.connection_pool.create()
+ finally:
self.connection_pool.put(self.connection)
else:
try: