Bug 1312061
Summary: | rcache leaks fd when using AuthContext with KRB5_AUTH_CONTEXT_DO_TIME | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Jan Stancek <jstancek> |
Component: | python-krbV | Assignee: | John Dennis <jdennis> |
Status: | CLOSED WONTFIX | QA Contact: | Namita Soman <nsoman> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.7 | CC: | dcallagh, dpal, jburke, jplans, nalin, pkis, rharwood |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2017-12-06 10:31:17 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Jan Stancek
2016-02-25 16:14:23 UTC
I just realized, that maybe this is because python doesn't release auth_context objects immediately. And "context.default_rcache()" works around that because it keeps single instance around through entire life-time. (In reply to Jan Stancek from comment #2) > I just realized, that maybe this is because python doesn't release > auth_context objects immediately. And "context.default_rcache()" works > around that because it keeps single instance around through entire life-time. That makes sense to me. Adding in python-krbV to hopefully provide more information. After call rd_req, auth_context never gets released - gdb never triggers on krb5_auth_con_free(). I added following to end of login_krbv() ... import gc import sys gc.collect() print 'auth_context', auth_context print str(sys.getrefcount(auth_context)) print str(auth_context) print str(gc.get_referrers(auth_context)) And this is what I get: auth_context <krbV.AuthContext instance at 0x2c2ec20> 2 <krbV.AuthContext instance at 0x2c2ec20> [<frame object at 0x7f766400a250>] I don't get the first referrer. It looks like it's referencing itself. Perhaps it's coming from this code? static PyObject* Context_rd_req(PyObject *unself, PyObject *args, PyObject *kw) ... if(auth_context) { Py_INCREF(auth_context); } Here's a reproducer that should demonstrate the problem: -------------------------------------------------------------------------- import krbV import sys import gc def login_krbv(): context = krbV.default_context() auth_context = krbV.AuthContext(context = context) for i in range(0, 3): print sys.getrefcount(auth_context._ac) print gc.get_referrers(auth_context._ac) auth_context.flags = (krbV.KRB5_AUTH_CONTEXT_DO_SEQUENCE | krbV.KRB5_AUTH_CONTEXT_DO_TIME) login_krbv() -------------------------------------------------------------------------- python reproducer.py 2 [{'_ac': <PyCObject object at 0x7f9c882ec378>, 'context': <krbV.Context instance at 0x7f9c88236758>}] 3 [{'_ac': <PyCObject object at 0x7f9c882ec378>, 'context': <krbV.Context instance at 0x7f9c88236758>}] 4 [{'_ac': <PyCObject object at 0x7f9c882ec378>, 'context': <krbV.Context instance at 0x7f9c88236758>}] -------------------------------------------------------------------------- If I run this via gdb with breakpoint set on destroy_ac(), it never triggers. If I comment the 2 lines with "auth_context.flags = ...", breakpoint triggers. Or with ltrace: # ltrace --dl python reproducer.py 2>&1 | grep destroy_ac # # # After commenting out flags line # ltrace --dl python reproducer.py 2>&1 | grep destroy_ac (11597) destroy_ac I'm guessing this is PyObject_GetAttrString() in Context_setattr() grabbing new reference that is never Py_DECREF-ed. If I add that, reproducer above no longer works: AuthContext_setattr(PyObject *unself __UNUSED, PyObject *args) ... tmp = PyObject_GetAttrString(self, "_ac"); if(tmp) { ac = PyCObject_AsVoidPtr(tmp); Py_DECREF(tmp); } Red Hat Enterprise Linux 6 is in the Production 3 Phase. During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available. The official life cycle policy can be reviewed here: http://redhat.com/rhel/lifecycle This issue does not meet the inclusion criteria for the Production 3 Phase and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification. Note that a strong business justification will be required for re-evaluation. Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL: https://access.redhat.com/ |