Leaking HTTP requests (was: RE: [Zope] Leaking Acquisition.Im plic itAcquirerWrapper)

Dieter Maurer dieter at handshake.de
Sun May 16 17:48:12 EDT 2004


Jean-Francois.Doyon at CCRS.NRCan.gc.ca wrote at 2004-5-14 17:23 -0400:
> ...
>I'll leave the iste running throught the week-end and we'll see what shows
>up.
>"high" refcounts is somewhat arbitrary I guess ... When you say high you
>mean
>high and stable or high and growing?

In fact, I mean unexpectedly high. The relevant references counts
are not necessarily the highest ones.

For example, when you make catalog searches, it is completely
normal that you see lots of "DateTime" objects. Nevertheless,
you can be sure that they are not the cause of memory leaks.
The same applies for acquisition wrappers.
You must look for usually rare objects that suddenly show up
in large numbers.

It may help very much to clear the ZODB cache
("Control_Panel" --> "Database management" --> <databases> --> "Flush Cache"
--> "Minimize"). This should delete all objects from memory that
are "normal" artefacts of Zope processing. Apart from a few objects
only the leaked ones should remain.

Be warned, there was a bug in "cPickleCache.c" that led "Minimize"
enter an infinite loop. I am not sure whether this bug is
fixed in the current Zope 2.7 release.

>Right now, the only suspect class as far as refcounts (Other than the HTTP
>requests) is the DateTime one.  I have some content ones that look high,
>but then they're highly used (CMFImage for example).

"DateTime" are normal, "HTTP requests" is strange....


>Apart from using aq_explicit in a few places, I do also use __of__ in one
>case ... To do things like:
>
>    def getAbstract(self):
>        try:
>            pt = ZopePageTemplate( '', self.abstract,
>'text/html').__of__(self)
>            cookedbody = pt()

Harmless.

The problem in my code has been that I stored an acquisition
wrapped object in my object.

> ...
>How about this?
>
>pt = ZopePageTemplate( '', self.aq_explicit.intropart1, 'text/html'
>).__of__(self)
>
>Could THAT be bad?

Unlikely (unless you store it as attribute of "self").


-- 
Dieter



More information about the Zope mailing list