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

hazmat hazmat@objectrealms.net
Sat, 08 Mar 2003 02:46:22 +0100


Toby Dickenson wrote:

>On Friday 07 March 2003 4:48 pm, Christian Reis wrote:
>  
>
>>On Fri, Mar 07, 2003 at 11:31:22AM -0500, Jeremy Hylton wrote:
>>    
>>
>>>>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?
>>>      
>>>
>>No, it doesn't. db.close() should close the storage
>>    
>>
>
>Should it? We have to create the storage explicitly, so why shouldnt we have 
>to call storage.close explicitly too?
>

in the case of the opening a db, it doesn't know what storage maybe 
used. in the case of closing a db, it can act as a simple proxy to a 
universal storage interface, and there by simplify interface semantics 
imo. iotw. once the filestorage is used in intial creation of the db, it 
is never used again. while the db remains the primary construct for 
connection creation, etc. imo, db proxying close to storage is more 
intuitive... though the original issue is much more concerned with open 
connections on closed storages leaking, and time windows for closing 
storages.

on a busy server, perhaps its better to schedule a storage close, via 
denying new opens, or some variant, as a txn might almost always be in 
process.

-haz