No memory leak! (was: Re: [Zope] Memory Leak in Session Data Container)

Dieter Maurer dieter at handshake.de
Fri Apr 14 08:53:59 EDT 2006


Dieter Maurer wrote at 2006-4-11 22:14 +0200:
>Andy Yates wrote at 2006-4-10 12:43 -0500:
>> ...
>>Fortunately, I have an easy way to reproduce the problem and even better
>>I've found a work around.  My hope is that the work around will lead
>>somebody more familiar with the innards of Zope to where the problem is
>>located.
>
>Congratulations!
>
>I will look into this within the next days (in Zope 2.8.1, however).

I checked this:
 
   There is no memory leak related to session handling in Zope 2.8.1!

> ...
>The ZODB cache may keep your session objects (and thereby its
>content) alive.

Almost surely, this is what happened in Andy's test.


Here is a description how I checked for the existence of a memory
leak:

  I instrumented the pickles in "tempstorage.TemporaryStorage.TemporaryStorage"
  such that I can find out the number of pickles stored
  (similar to the reference counts in "Control_Panel/DebugInfo").

  I performed a mass test, creating thousands of sessions
  (similar to Andy's test).

  The pickle number stored by "TemporaryStorage" grew as expected
  (as it stores the sessions).

  I forced all session objects maintained by "/temp_folder/session_data"
  to be discarded.

  Creating a single new session caused almost all "TemporaryStorage"
  pickles to be released.

  However, the ZODB caches still contained about 20.000 session
  objects. It was very surprising (and contrary to my previous
  message) that the storage flushed most of its pickles
  while references to them were still in the ZODB caches.
  This looks like a bug (but not a memory leak).

  I flushed the ZODB caches.

  I repeated the test and verified that the number of
  pickles remaining in "TemporaryStorage" does not increase.


Results:
 
  * no memory leak!

  * maybe something that looks like a memory leak caused by the ZODB caches
    which may hold up to 20.000 (with standard configuration) no
    longer used objects

    A more senseful configuration can work around this.


-- 
Dieter


More information about the Zope mailing list