Hide Forgot
Created attachment 526541 [details] leak-generation script Description of problem: Repeatedly querying for objects in the pure-python QMF console results in a memory leak. It appears that qmf.console.Object and qmf.console.ObjectID instances are retained for every object that is returned as the result of a query, so that if there are 1000 objects of class Foo on the agent, calling console.getObjects(_class="Foo") 10 times would result in 1000 leaked qmf.console.Object instances. Attached is a heap dump (generated using heapy from python-guppy) and a script to reproduce this problem. Version-Release number of selected component (if applicable): python-qpid-qmf-0.10-2 Steps to Reproduce: 1. Run a wallaby agent and create many nodes, e.g. with the following wallaby console incantation: ("aaa".."eee").each {|nm| ::Wallaby::store.addNode("fake-#{nm}.fakenodes.org")} 2. Run the attached leaky.py script. Actual results: Objects are unnecessarily retained in numbers directly proportional to the number of objects returned by queries. (That is, querying for the same object multiple times results in multiple objects being retained.) Expected results: Ideally, no objects should be retained.
Created attachment 526542 [details] heap profile from running leaky.py against ~2800 Wallaby nodes
Created attachment 528520 [details] Fixes the slow leak of instances of objects in the Python console.
Researching this, the specific objects that leak are: qmf.console.Object qmf.console.ObjectId qmf.console.RequestContext qmf.console.SessionGetRequest These are being held in the Agent.seqMgr. When RequestContext._complete was invoked, it would clear the Agent's context, but not the Agent's sequence manager, which was holding onto the reference to the request and the result.
Created attachment 528521 [details] Fixes the slow leak of instances of objects in the Python console. Uploaded the wrong patch previously. This replaces that.
This issue has been fixed Verified on RHEL6.2 x86_64, i686 heap profile from running leaky.py against ~2800 Wallaby nodes: qpid-qmf-0.10-10.el6.x86_64: Partition of a set of 668567 objects. Total size = 89957464 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 28141 4 29491768 33 29491768 33 dict of qmf.console.Object 1 56293 8 15762040 18 45253808 50 dict of qmf.console.ObjectId 2 179776 27 13053408 15 58307216 65 tuple 3 85198 13 8231984 9 66539200 74 list 4 134082 20 8162680 9 74701880 83 str 5 28281 4 4096280 5 78798160 88 unicode 6 56293 8 4053096 5 82851256 92 qmf.console.ObjectId 7 28141 4 1801024 2 84652280 94 qmf.console.Object 8 56760 8 1362240 2 86014520 96 int 9 135 0 412584 0 86427104 96 dict of module qpid-qmf-0.12-6.el6.x86_64: x86_64: Partition of a set of 50245 objects. Total size = 7046144 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 22081 44 1894392 27 1894392 27 str 1 11068 22 907040 13 2801432 40 tuple 2 141 0 421944 6 3223376 46 dict of module 3 431 1 394856 6 3618232 51 dict of type 4 431 1 386744 5 4004976 57 type 5 518 1 375824 5 4380800 62 dict (no owner) 6 3018 6 362160 5 4742960 67 function 7 3016 6 361920 5 5104880 72 types.CodeType 8 306 1 320688 5 5425568 77 dict of qmf.console.SchemaArgument 9 246 0 240912 3 5666480 80 dict of class i686: Partition of a set of 50242 objects. Total size = 4034672 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 22078 44 1486264 37 1486264 37 str 1 11068 22 409244 10 1895508 47 tuple 2 141 0 210408 5 2105916 52 dict of module 3 3016 6 205088 5 2311004 57 types.CodeType 4 431 1 195704 5 2506708 62 dict of type 5 431 1 192268 5 2698976 67 type 6 518 1 185840 5 2884816 72 dict (no owner) 7 3018 6 169008 4 3053824 76 function 8 306 1 159120 4 3212944 80 dict of qmf.console.SchemaArgument 9 246 0 119472 3 3332416 83 dict of class -> VERIFIED
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2011-1671.html