summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-keystoneclient
diff options
context:
space:
mode:
authorAmy Fong <amy.fong@windriver.com>2014-03-28 15:58:45 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-03-31 13:14:49 -0400
commit02f129b1bb1fc17f17b2fbca43bd997aa8b28d09 (patch)
treea125ec774f2054684ddd364aeb6caceb8c1bf637 /meta-openstack/recipes-devtools/python/python-keystoneclient
parent984c2d69f51824a4c1e7b3a448fe24759e594026 (diff)
downloadmeta-cloud-services-02f129b1bb1fc17f17b2fbca43bd997aa8b28d09.tar.gz
Memory leak from timings
Memory leak happens when the dynamic list times grows without anything to reset it. In ceilometer and cinder configuration files, the new option is created: [nova_client] max_timing_buffer=<value> In all clients found that uses extends the HTTPClient and uses the times list, we limit the size of the list by popping off the oldest item in the list to maintain a maximum size. A default size of 200 is chosen, configurable by the above configuration option. Signed-off-by: Amy Fong <amy.fong@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-keystoneclient')
-rw-r--r--meta-openstack/recipes-devtools/python/python-keystoneclient/fix_keystoneclient_memory_leak.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-keystoneclient/fix_keystoneclient_memory_leak.patch b/meta-openstack/recipes-devtools/python/python-keystoneclient/fix_keystoneclient_memory_leak.patch
new file mode 100644
index 0000000..05a1d23
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-keystoneclient/fix_keystoneclient_memory_leak.patch
@@ -0,0 +1,37 @@
1---
2 keystoneclient/openstack/common/apiclient/client.py | 10 ++++++++++
3 1 file changed, 10 insertions(+)
4
5--- a/keystoneclient/openstack/common/apiclient/client.py
6+++ b/keystoneclient/openstack/common/apiclient/client.py
7@@ -90,6 +90,7 @@
8 self.user_agent = user_agent or self.user_agent
9
10 self.times = [] # [("item", starttime, endtime), ...]
11+ self.times_max_len = 200
12 self.timings = timings
13
14 # requests within the same session can reuse TCP connections from pool
15@@ -142,6 +143,12 @@
16 def reset_timings(self):
17 self.times = []
18
19+ def get_timings_max_len(self):
20+ return self.times_max_len
21+
22+ def set_timings_max_len(self, new_len):
23+ self.times_max_len = new_len
24+
25 def request(self, method, url, **kwargs):
26 """Send an http request with the specified characteristics.
27
28@@ -173,6 +180,9 @@
29 if self.timings:
30 self.times.append(("%s %s" % (method, url),
31 start_time, time.time()))
32+ # remove oldest items until we maintain max length
33+ while len(self.times) > self.times_max_len:
34+ del self.times[0]
35 self._http_log_resp(resp)
36
37 if resp.status_code >= 400: