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 7d53fb8322
commit bcd37088bd
1 changed files with 2 additions and 1 deletions

View File

@ -177,6 +177,7 @@ Additional information about the services can be found in the
:ref:`service-proxies` documentation.
"""
import warnings
import weakref
import keystoneauth1.exceptions
import requestsexceptions
@ -431,7 +432,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)
return self._session
def add_service(self, service):