[Zope-dev] Re: Preliminary findings: Zope 2.7 leakage caused by errors

"J. David Ibáñez" jdavid at itaapy.com
Fri May 21 08:17:14 EDT 2004


The problem I have with one of my sites seems to have a different cause, 
as it
does not show up when errors occur, but when requests are succesful.

So far I haven't been able to reproduce the problem.

You can try to modify "new_publish" to catch exceptions:

def new_publish(request, module_name, after_list, debug=0):
    id = get_ident()
    Publish._requests[id] = request
    try:
        x = Publish.old_publish(request, module_name, after_list, debug)
    except:
        del Publish._requests[id]
        raise
    else:
        try:
            del Publish._requests[id]
        except KeyError:
...


Though it is unlikely the leak to be there.




Jean-Francois.Doyon at CCRS.NRCan.gc.ca wrote:

>Indeed, I was hoping the ref in the dictionary there was getting in the way
>when old_publish was raising an exception, but I tried using a
>weakref.proxy()
>instead and that didn't help.
>
>I managed to test without Localizer (It dawned on me that since I'm looking
>at errors, it really doesn't matter if I don't have Localizer installed
>since
>not having it will generate errors, which is what I want!) ... And the
>problem
>diappeared ...
>
>So it's definitely Localizer, but it's not the Globals() request patch ...
>Or
>at least not the act of patching it itself, that causes the problem.
>
>*sigh*
>J.F.
>
>-----Original Message-----
>From: Dieter Maurer [mailto:dieter at handshake.de]
>Sent: May 20, 2004 2:58 PM
>To: Jean-Francois.Doyon at CCRS.NRCan.gc.ca
>Cc: jdavid at itaapy.com; tseaver at zope.com; zope-dev at zope.org;
>chrism at plope.com; brian at zope.com
>Subject: RE: [Zope-dev] Re: Preliminary findings: Zope 2.7 leakage
>caused by errors
>
>
>Jean-Francois.Doyon at CCRS.NRCan.gc.ca wrote at 2004-5-20 09:58 -0400:
>  
>
>>...
>>def new_publish(request, module_name, after_list, debug=0): 
>>   id = get_ident() 
>>   print "Localizer got thread id: " + str(id)
>>   Publish._requests[id] = request 
>>   print "Request dict is now: " + str(Publish._requests)   
>>   x = Publish.old_publish(request, module_name, after_list, debug) 
>>   try:
>>       del Publish._requests[id]
>>   except KeyError:
>>...
>>    
>>
>
>This code cannot leak requests in large numbers (though it may
>leak a few requests for some time).
>
>Reason: Zope does not normally create new threads. This implies
>that thread_ids are reused and thereby old requests flushed from
>the dict.
>
>  
>


-- 
J. David Ibáñez
Founder and CTO of Itaapy <http://www.itaapy.com>
9 rue Darwin, 75018 Paris
Tel +33 (0)1 42 23 67 45 / Fax +33 (0)1 53 28 27 88 




More information about the Zope-Dev mailing list