[ZODB-Dev] Re: Connection pool makes no sense

Tim Peters tim at zope.com
Fri Dec 30 15:40:09 EST 2005


[Tim Peters]
...
>> I suggested before that forcing calls to gc.collect() would give more
>> evidence.  If that doesn't help, then it's most likely that the
>> application is keeping Connections alive.

[David Rushby]
> I'm not the OP, but I was able to reproduce the problem he was
> encountering.  Calls to gc.collect() *do* solve the problem, without
> any changes to the application.

Thank you!  That's progress.

> But mightn't clearing the released ZODB Connection's cache
> (http://mail.zope.org/pipermail/zodb-dev/2005-December/009688.html ) be a
> better solution?

I didn't suggest it as "a solution", but as a way to get evidence.  Now I'd
like to know whether adding gc.collect() solves the OP's problem, in the
OP's original context, too.

I expect that clearing the cache when _ConnectionPool "forgets" a Connection
is harmless, but that will take more thought to be sure, and in any case it
doesn't address that trash Connection objects, and trash caches, would still
accumulate.  If possible, I would rather fix the underlying problem than
just relieve the symptom du jour.  For example, maybe it's a bug in Python's
gc after all, or maybe it would be better to break the reference cycles when
_ConnectionPool forgets a Connection (so that the trash gets reclaimed right
then, instead of waiting for a gc collection cycle to reach the generation
in which the trash lives).



More information about the ZODB-Dev mailing list