[ZODB-Dev] Opening 7 Connections hangs (and __del__)

Jeremy Hylton jeremy@zope.com
31 Jan 2003 10:01:01 -0500


Christian--

You're very thorough by you're overlooking the obvious :-).  You did
all that work to get a C stack trace for the program, but you didn't
look at the implementation of open()!  So you've missed an obscure
"feature."

A database use a thread lock to prevent more than N threads from
opening database connections at one time.  The number is configurable
via the pool_size argument to the DB constructor.

The reason __del__ isn't getting called is that Connections are never
destroyed, they're just recycled.  The idea is that the cache for a
previously used connection may contain objects useful for the next
client to call open().

We're planning to eliminate at least the locking part of the
connection pool in ZODB4.  Instead of blocking, you'd just allocate a
new connection.  The feature exists in its current shape because Zope
wants it that way, but it's really an application issue that got
pushed into the database.  That said, I think the notion of reusing
connections is generally useful, so that it ought to stay in the
database.  But I'm open to arguments that it belongs somewhere else.

Jeremy