[Zope-dev] Memory Leak Problem

Oliver Bleutgen myzope@gmx.net
Wed, 13 Mar 2002 11:37:00 +0100


Toby Dickenson wrote:
> On Tue, 12 Mar 2002 18:38:16 +0100, Oliver Bleutgen <myzope@gmx.net>
> wrote:
> 
> 
>>Acquisition.ImplicitAcquirerWrapper: 42442
>>
> 
> That class is used to glue together acquisition content chains. Being
> top of the list indicates that you have been leaking an acquisition
> context chain. 
> 
> That doesnt mean that the bug relates to acquisition; acquisition just
> means that the leak is more severe than otherwise (because it keeps
> the whole context chain around).
> 
> 
>>OFS.DTMLMethod.DTMLMethod: 3989
>>
> 
> 42442/3989 = 10.6.
> That indicates that you are leaking an acquisition chain of roughly 10
> objects.
> 
> 
>>ZPublisher.HTTPRequest.HTTPRequest: 3941
>>ZServer.HTTPResponse.ZServerHTTPResponse: 3934
>>ZPublisher.BaseRequest.RequestContainer: 3931
>>AccessControl.DTML.TemplateDict: 3930
>>
> 
> The numbers for those objects are all roughly 3900. These objects are
> the ones referenced by that acquisition chain.
> 
> I recommend you look further down that list, until you find a number
> that is much less than 3900. All of the objects above that mark are
> pieces of the jigsaw puzzle that will tell you *what* is being leaked.
> Thats where I would start meditating to work out *how* its being
> leaked.

Ah, thanks for the nice explanation, Toby. I don't want to abuse your or 
others time too much, but since this might be interesting in general 
too, I'll give some more data. To be clear, I don't want to really trace 
down that leak, we live with it for nearly a year now, the server will 
be replaced soon, but I'm smelling some zen and my appetite is whet.

- I did paste only the objects which have such a high count (next one 
was approx 200).
- This server (2.3.3) has no special products on it, just 2 Folderish 
ZClasses, which are heavily used (they construct the whole site).

So, can we rule out that there's a bug in the zclasses machinery which 
is the cause for this? I.e. should there be some zclass related object 
in the above list otherwise?

Is it right that in Zope 2.3.x (and others?) usage of
<dtml-var "REQUEST.set(...)"> can lead to such leakage?

Is there a description somewhere what the basic causes of such leakages 
are? I.e. only bugs in python c-code/zope c-code?

Is there some text about what to not do in python product development to 
avoid introducing leakage? For example, on #zope someone pointed out to 
me that storing acquisition wrappers in the ZODB will lead to leakage.

cheers,
oliver