Keep connection backrefs with weakref.proxy

We're storing references to the connection object on
proxy objects and the senlin folks are seeing memory
leaks. Storing them in weakrefs.

Change-Id: Ie0cffc402747d070c1eae1d9b423a046936d917d
(cherry picked from commit 0e8e361637)
This commit is contained in:
Monty Taylor 2019-11-23 06:42:14 -05:00 committed by Erik Olof Gunnar Andersson
parent 3b9f369410
commit 1462454923
1 changed files with 2 additions and 1 deletions

View File

@ -161,6 +161,7 @@ __all__ = [
]
import warnings
import weakref
import keystoneauth1.exceptions
import requestsexceptions
@ -308,7 +309,7 @@ class Connection(six.with_metaclass(_meta.ConnectionMeta)):
# Hide a reference to the connection on the session to help with
# backwards compatibility for folks trying to just pass conn.session
# to a Resource method's session argument.
self.session._sdk_connection = self
self.session._sdk_connection = weakref.proxy(self)
self._proxies = {}