Bug 743657 - The pure-python QMF console unnecessarily retains references to query results
Summary: The pure-python QMF console unnecessarily retains references to query results
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qpid-qmf
Version: 6.1
Hardware: All
OS: Linux
urgent
high
Target Milestone: rc
: 6.2
Assignee: Darryl L. Pierce
QA Contact: Petr Matousek
URL:
Whiteboard:
Depends On:
Blocks: 748554
TreeView+ depends on / blocked
 
Reported: 2011-10-05 16:25 UTC by Will Benton
Modified: 2011-12-06 16:51 UTC (History)
8 users (show)

Fixed In Version: qpid-qmf-0.12-6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 16:51:22 UTC
Target Upstream Version:


Attachments (Terms of Use)
leak-generation script (876 bytes, text/x-python-script)
2011-10-05 16:25 UTC, Will Benton
no flags Details
heap profile from running leaky.py against ~2800 Wallaby nodes (729 bytes, text/plain)
2011-10-05 16:27 UTC, Will Benton
no flags Details
Fixes the slow leak of instances of objects in the Python console. (938 bytes, patch)
2011-10-17 12:15 UTC, Darryl L. Pierce
no flags Details | Diff
Fixes the slow leak of instances of objects in the Python console. (983 bytes, patch)
2011-10-17 12:23 UTC, Darryl L. Pierce
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 748738 0 high CLOSED The pure-python QMF console unnecessarily retains references to query results -- cumin-web process leaks ~800kb/min 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2011:1671 0 normal SHIPPED_LIVE qpid-qmf bug fix and enhancement update 2011-12-06 00:50:14 UTC

Internal Links: 748738

Description Will Benton 2011-10-05 16:25:54 UTC
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.

Comment 1 Will Benton 2011-10-05 16:27:00 UTC
Created attachment 526542 [details]
heap profile from running leaky.py against ~2800 Wallaby nodes

Comment 4 Darryl L. Pierce 2011-10-17 12:15:07 UTC
Created attachment 528520 [details]
Fixes the slow leak of instances of objects in the Python console.

Comment 5 Darryl L. Pierce 2011-10-17 12:22:26 UTC
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.

Comment 6 Darryl L. Pierce 2011-10-17 12:23:09 UTC
Created attachment 528521 [details]
Fixes the slow leak of instances of objects in the Python console.

Uploaded the wrong patch previously. This replaces that.

Comment 9 Petr Matousek 2011-11-09 15:56:03 UTC
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

Comment 10 errata-xmlrpc 2011-12-06 16:51:22 UTC
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


Note You need to log in before you can comment on or make changes to this bug.