Leaking HTTP requests (was: RE: [Zope] Leaking Acquisition.Im
plic itAcquirerWrapper)
Jean-Francois.Doyon at CCRS.NRCan.gc.ca
Jean-Francois.Doyon at CCRS.NRCan.gc.ca
Fri May 14 17:23:45 EDT 2004
Dieter,
Argh, I don't even see the problem in your example :( (I'm having a bad
day!)
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?
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).
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()
return cookedbody
except:
return ''
Could such use cause problems? I don't see why ... It's quite
straightforward.
That's about as fancy as anything I do gets I'm afraid, so I'm still having
a hard
time imagining anything I wrote messing with Wrappers ... I make it a point
to avoid
them!
Oh wait a minute ...
How about this?
pt = ZopePageTemplate( '', self.aq_explicit.intropart1, 'text/html'
).__of__(self)
Could THAT be bad? I'l look into it, it'll be easy to detect.
TGIF, I'm loosing morale here ...
Thanks for the help! The hunt continues ...
J.F.
-----Original Message-----
From: Dieter Maurer [mailto:dieter at handshake.de]
Sent: May 14, 2004 2:28 PM
To: Jean-Francois.Doyon at CCRS.NRCan.gc.ca
Cc: stefan at epy.co.at; zope at zope.org
Subject: Re: Leaking HTTP requests (was: RE: [Zope] Leaking
Acquisition.Implic itAcquirerWrapper)
Jean-Francois.Doyon at CCRS.NRCan.gc.ca wrote at 2004-5-13 15:31 -0400:
>Looks like I'm actually leaking HTTP requests!
I fear I brought in the "leaking HTTP requests" story...
Meanwhile, I understand that whenever you leak AcquisitionWrappers
you are leaking HTTP requests, too. That's because at the
bottom of the acquisition chain is a REQUEST (usually an
HTTPRequest).
While a cycle created by storing an acquisition wrapper
into REQUEST may cause this leakage, it is by far not the only
potential cause.
Yesterday, I found a leak in my DOM wrapper code caused by code like
this:
class Element(Implicit,...)
__children = None
def getChildren(self):
'''the elements children.'''
if self.__children is not None: return self.__children
children = self.__children \
= NodeList([c.__of__(self) for c in self._proxy.children])
This creates a cycle between acquisition wrappers.
And leaks acquisition wrappers as well as Request objects....
The major clue to solve my problem has been to look for further
high reference counts for classes that are supposed to have
small reference counts. In my case, I found "DOM.Document",
created at a single place. That allowed me to quickly
verify that I indeed leaked "DOM.Document" references (and everything
below) and after I few hours, I found the code above...
--
Dieter
More information about the Zope
mailing list