memory leak for _safe_log in openstack.common.rpc
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.messaging |
Fix Released
|
High
|
jazeltq |
Bug Description
we first find this bug in ceilometer.
def _safe_log(log_func, msg, msg_data):
"""Sanitizes the msg_data field before logging."""
SANITIZE = ['_context_
def _fix_passwords(d):
for k in d.iterkeys():
if k.lower(
elif k.lower() in SANITIZE:
elif isinstance(d[k], dict):
return d
return log_func(msg, _fix_passwords(
we find that in gc.garbage, there are many things like those:
['_context_
(<cell at 0x363e1a0: list object at 0x363cdd0>,
<cell at 0x363e130: function object at 0x361a7d0>),
<function _fix_passwords at 0x361a7d0>,
<cell at 0x363e2f0: list object at 0x361b368>,
<cell at 0x363e4e8: function object at 0x361a8c0>,
['_context_
(<cell at 0x363e2f0: list object at 0x361b368>,
<cell at 0x363e4e8: function object at 0x361a8c0>),
<function _fix_passwords at 0x361a8c0>,
<cell at 0x363e520: list object at 0x3640440>,
<cell at 0x363e4b0: function object at 0x361a9b0>,
['_context_
(<cell at 0x363e520: list object at 0x3640440>,
<cell at 0x363e4b0: function object at 0x361a9b0>),
<function _fix_passwords at 0x361a9b0>,
<cell at 0x363e670: list object at 0x361b4d0>,
<cell at 0x363e868: function object at 0x361aa28>,
['_context_
(<cell at 0x363e670: list object at 0x361b4d0>,
<cell at 0x363e868: function object at 0x361aa28>),
And we change the function a little, like this
def _safe_log(log_func, msg, msg_data):
"""Sanitizes the msg_data field before logging."""
SANITIZE = ['_context_
def _fix_passwords(d):
for k in six.iterkeys(d):
if k.lower(
elif k.lower() in SANITIZE:
elif isinstance(d[k], list):
for e in d[k]:
elif isinstance(d[k], dict):
return d
res = log_func(msg, _fix_passwords(
_fix_passwords = None
return res
After those, change, we find there are no more things find above.
affects: | ceilometer → oslo-incubator |
no longer affects: | oslo-incubator |
Changed in oslo.messaging: | |
assignee: | nobody → jazeltq (jazeltq-k) |
description: | updated |
Changed in oslo.messaging: | |
status: | New → In Progress |
description: | updated |
Changed in oslo.messaging: | |
importance: | Undecided → High |
Changed in oslo.messaging: | |
status: | In Progress → Fix Committed |
Changed in oslo.messaging: | |
milestone: | none → 1.5.0 |
status: | Fix Committed → Fix Released |
Fix proposed to branch: master /review. openstack. org/119524
Review: https:/