[Checkins] SVN: zope.app.testing/trunk/ Fix memory leak in all functional tests.

Marius Gedminas marius at pov.lt
Fri Jul 25 21:32:35 EDT 2008


(Thank you for the explicit Cc:)

On Fri, Jul 25, 2008 at 02:48:46PM -0400, Fred Drake wrote:
> On Fri, Jul 25, 2008 at 1:06 PM, Marius Gedminas <marius at pov.lt> wrote:
> > Log message for revision 88823:
> >  Fix memory leak in all functional tests.
> >
> >  See: https://bugs.launchpad.net/zope3/+bug/251273
> 
> Updating from 3.4.2 to 3.4.3 in a large application caused problems;
> I'm getting exceptions like this:
> 
>   File "~/.buildout/eggs/zope.component-3.4.0-py2.4.egg/zope/component/registry.py",
> line 290, in subscribers
>     return self.adapters.subscribers(objects, provided)
>   File "~/.buildout/eggs/ZODB3-3.8.1b6-py2.4-macosx-10.3-i386.egg/ZODB/Connection.py",
> line 808, in setstate
>     raise ConnectionStateError(msg)
> ConnectionStateError: Shouldn't load state for 0x0d when the
> connection is closed

Interesting.  When I used to get ConnectionStateErrors usually the
problem was objects being kept in memory from older tests.  Very often a
transaction.abort() in my test's tearDown() fixed it (the tricky part
being to figure out which test left that object, because the error
usually occurred later, in an unrelated test).  I had modified my test
runner to look for tests that leave unclean transactions after them and
warn about them early.

> I'll try and look into this when I get a chance.  This is an
> application using multiple databases; not sure if that's relevant in
> this case.  There could be a bad interaction with our test layers as
> well; it's not clear this is really caused by a zope.app.testing
> problem.

I don't know why unregistering the IDatabase utilities triggers this
error for you.  I haven't touched the database & connection closing code
(except for moving the duplicated for loop into a method), and I don't
see how removing a utility registration could cause a database
connection to get closed as a side effect.

Marius Gedminas
-- 
The only way to learn a new programming language is by writing programs in it.
                -- Brian Kernighan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/checkins/attachments/20080726/18a2a703/attachment.bin


More information about the Checkins mailing list