Leaking HTTP requests (was: RE: [Zope] Leaking Acquisition.Implic itAcquirerWrapper)
Oh, wait a minute ... Looks like I'm actually leaking HTTP requests! Class May 12, 2004 5:08 pm May 13, 2004 3:26 pm Delta Acquisition.ImplicitAcquirerWrapper 7190 138920 +131730 ZPublisher.HTTPRequest.HTTPRequest 352 18123 +17771 ZPublisher.BaseRequest.RequestContainer 329 18095 +17766 ZServer.HTTPResponse.ZServerHTTPResponse 338 18103 +17765 I saw some traffic on this same topic about archetypes & plone ... Hopefully I'll be able to track this down more easily than wrapper problems. Still any input will be appreciated, tracking down memory leaks always seems like black magic to me :P Thanks, J.F. -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org]On Behalf Of Jean-Francois.Doyon@CCRS.NRCan.gc.ca Sent: May 13, 2004 1:46 PM To: stefan@epy.co.at Cc: zope@zope.org Subject: RE: [Zope] Leaking Acquisition.ImplicitAcquirerWrapper Stefan, Hmmm actually yes ... Not quite as high as the wrapper, but higher than I'd expect, right this moment I've got 124219 for the wrapper and 48965 for DateTime ... I use standard user folders everywhere, I don't do anything special with them ... So I have one in the root and one in each of two CMF instances. I removed the "Members" folder ... I have about 4 or 5 users in each, most access to the site is anonymous. Although now that you say it, it'd be interesting to see if removing user-based/authenticated access solves the problem. I've been trying to replicate the problem on a second copy of the site without success ... But then I never authenticated against it other than through the ZMI ... I'm looking forward to your response now that you've peaked my curiosity :) Thanks for the help, J.F. -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org]On Behalf Of Stefan H. Holek Sent: May 13, 2004 1:00 PM To: Jean-Francois.Doyon@ccrs.nrcan.gc.ca Cc: zope@zope.org Subject: Re: [Zope] Leaking Acquisition.ImplicitAcquirerWrapper a) Are you also seeing high refcounts for DateTime objects? b) Which user folder do you have? Stefan On Donnerstag, Mai 13, 2004, at 17:02 Europe/Vienna, Jean-Francois.Doyon@CCRS.NRCan.gc.ca wrote:
I'm using Zope 2.7 w/ python 2.3.3 on RH7.3 with - CMF 1.4.2 - TranslationService - Localizer - mxmRelations - ZPsycopgDA
-- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/ _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
This confirms my suspicion somewhat that the global request patch is to blame. IIRC Localizer uses this, doesn't it? Do you have the possibility to test without the (monkey?) patch, or without Localizer entirely? Huima has just recently reported pretty much the same bug and he is using PTS, which again utilizes the global request patch (I think). Stefan On Donnerstag, Mai 13, 2004, at 21:31 Europe/Vienna, Jean-Francois.Doyon@CCRS.NRCan.gc.ca wrote:
Oh, wait a minute ...
Looks like I'm actually leaking HTTP requests!
Class May 12, 2004 5:08 pm May 13, 2004 3:26 pm Delta Acquisition.ImplicitAcquirerWrapper 7190 138920 +131730 ZPublisher.HTTPRequest.HTTPRequest 352 18123 +17771 ZPublisher.BaseRequest.RequestContainer 329 18095 +17766 ZServer.HTTPResponse.ZServerHTTPResponse 338 18103 +17765
I saw some traffic on this same topic about archetypes & plone ...
Hopefully I'll be able to track this down more easily than wrapper problems.
Still any input will be appreciated, tracking down memory leaks always seems like black magic to me :P
Thanks, J.F.
-- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
FWIW - zope.org is suffering hugely from this as well, so I'm following this thread eagerly ;) Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com
-----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org]On Behalf Of Stefan H. Holek Sent: Thursday, May 13, 2004 2:37 PM To: Jean-Francois.Doyon@CCRS.NRCan.gc.ca Cc: zope@zope.org Subject: Re: Leaking HTTP requests (was: RE: [Zope] Leaking Acquisition.ImplicitAcquirerWrapper)
This confirms my suspicion somewhat that the global request patch is to blame. IIRC Localizer uses this, doesn't it?
Do you have the possibility to test without the (monkey?) patch, or without Localizer entirely?
Huima has just recently reported pretty much the same bug and he is using PTS, which again utilizes the global request patch (I think).
Stefan
On Donnerstag, Mai 13, 2004, at 21:31 Europe/Vienna, Jean-Francois.Doyon@CCRS.NRCan.gc.ca wrote:
Oh, wait a minute ...
Looks like I'm actually leaking HTTP requests!
Class May 12, 2004 5:08 pm May 13, 2004 3:26 pm Delta Acquisition.ImplicitAcquirerWrapper 7190 138920 +131730 ZPublisher.HTTPRequest.HTTPRequest 352 18123 +17771 ZPublisher.BaseRequest.RequestContainer 329 18095 +17766 ZServer.HTTPResponse.ZServerHTTPResponse 338 18103 +17765
I saw some traffic on this same topic about archetypes & plone ...
Hopefully I'll be able to track this down more easily than wrapper problems.
Still any input will be appreciated, tracking down memory leaks always seems like black magic to me :P
Thanks, J.F.
-- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Does zope.org use Localizer or some type of "global request" patch? Stefan On Donnerstag, Mai 13, 2004, at 21:42 Europe/Vienna, Brian Lloyd wrote:
FWIW - zope.org is suffering hugely from this as well, so I'm following this thread eagerly ;) -- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
Zope.org doesn't use Localizer (or Archetypes - another thing that has come up in this thread). In our experience, this sort of thing has almost always turned out to be a wrapped object ending up in the REQUEST or a wrapped object holding onto a request for some reason. I've attached a quick product you can drop in to test that theory on your own instance (just make a directory Products/LeakBGone and drop this __init__.py into it and restart). If it fixes the leak, we can extend it to do some logging and try to figure out the root cause. I'll try it out on zope.org as soon as I'm able. Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com
-----Original Message----- From: zope-bounces+brian=zope.com@zope.org [mailto:zope-bounces+brian=zope.com@zope.org]On Behalf Of Stefan H. Holek Sent: Thursday, May 13, 2004 3:14 PM To: Brian Lloyd Cc: Jean-Francois.Doyon@CCRS.NRCan.gc.ca; zope@zope.org Subject: Re: Leaking HTTP requests (was: RE: [Zope] LeakingAcquisition.ImplicitAcquirerWrapper)
Does zope.org use Localizer or some type of "global request" patch?
Stefan
On Donnerstag, Mai 13, 2004, at 21:42 Europe/Vienna, Brian Lloyd wrote:
FWIW - zope.org is suffering hugely from this as well, so I'm following this thread eagerly ;) -- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Tres and me were playing around with this a little and the easiest way to provoke a REQUEST leak is to do an anonymous request to a resource inside a subfolder where the subfolder has all permission acquisition turned off (and only "authenticated" granted view access). It will turn around and try to run "standard_error_message", which will fail due to security (and leak in the process). The code responsible for this is SimpleItem.raise_standardErrorMessage, which does some funky passing around/munging of traceback objects. However, "raise_standardErrorMessage" never gets called if "standard_error_message" doesn't exist in the acquisition path. If it never gets called, the leak does not occur. The simplest way to rid yourself of the leak temporarily is to remove "standard_error_message". On Thu, 2004-05-13 at 17:41, Brian Lloyd wrote:
Zope.org doesn't use Localizer (or Archetypes - another thing that has come up in this thread).
In our experience, this sort of thing has almost always turned out to be a wrapped object ending up in the REQUEST or a wrapped object holding onto a request for some reason.
I've attached a quick product you can drop in to test that theory on your own instance (just make a directory Products/LeakBGone and drop this __init__.py into it and restart).
If it fixes the leak, we can extend it to do some logging and try to figure out the root cause. I'll try it out on zope.org as soon as I'm able.
Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com
-----Original Message----- From: zope-bounces+brian=zope.com@zope.org [mailto:zope-bounces+brian=zope.com@zope.org]On Behalf Of Stefan H. Holek Sent: Thursday, May 13, 2004 3:14 PM To: Brian Lloyd Cc: Jean-Francois.Doyon@CCRS.NRCan.gc.ca; zope@zope.org Subject: Re: Leaking HTTP requests (was: RE: [Zope] LeakingAcquisition.ImplicitAcquirerWrapper)
Does zope.org use Localizer or some type of "global request" patch?
Stefan
On Donnerstag, Mai 13, 2004, at 21:42 Europe/Vienna, Brian Lloyd wrote:
FWIW - zope.org is suffering hugely from this as well, so I'm following this thread eagerly ;) -- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
______________________________________________________________________ _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
(sounds of "AHAAA.." round the world) Thanks - I'm sure this is one of the things causing my zope growth.
Jean-Francois.Doyon@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
participants (6)
-
Brian Lloyd -
Chris McDonough -
Dieter Maurer -
Jean-Francois.Doyon@CCRS.NRCan.gc.ca -
Simon Michael -
Stefan H. Holek