[ZODB-Dev] ZODB: Are all handles closed?

Jeremy Hylton jeremy@zope.com
07 Mar 2003 11:31:22 -0500


On Fri, 2003-03-07 at 09:39, Toby Dickenson wrote:
> On Friday 07 March 2003 1:51 pm, Christian Reis wrote:
> > On Fri, Mar 07, 2003 at 02:21:07PM +0100, Ulla Theiss wrote:
> 
> >> We have separated the multiple openings and closings to the following
> >> code.
> >> It shows the increasing of the handles clearly.
> 
> Both of your scripts have a bug that is causing the problem demonstrated in 
> the second script. db.open returns a connection object, and you need to call 
> close on the connection, rather than the db. db.close is an alias for 
> storage.close.

This doesn't make much sense, does it?

If you close a database, the connection shouldn't continue to work.  The
most obvious solution is that close() on the database calls close() on
each connection.  In ZODB4, I just change Connection.close() so that it
raises an exception if close() is called while a transaction is active. 
So that would mean DB.close() could raise an exception.

Jeremy