Commit b4902e1c authored by Tim Peters's avatar Tim Peters

ZODBDatabase.open(): if the call to ZODB.DB() fails (== raises an

exception), explicitly close the storage passed to it, then re-raise
the exception.  Otherwise the storage remains open.  Turns out that
accounted for why test_zeo_config left a ConnectThread daemon thread
running (Zope3's test.py has been pointing that out for a loooong time).
parent b23a3ca2
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Open database and storage from a configuration. """Open database and storage from a configuration.
$Id: config.py,v 1.15 2003/10/02 18:17:19 jeremy Exp $""" $Id: config.py,v 1.16 2004/03/08 22:36:17 tim_one Exp $"""
import os import os
from cStringIO import StringIO from cStringIO import StringIO
...@@ -94,11 +94,16 @@ class ZODBDatabase(BaseConfig): ...@@ -94,11 +94,16 @@ class ZODBDatabase(BaseConfig):
def open(self): def open(self):
section = self.config section = self.config
return ZODB.DB(section.storage.open(), storage = section.storage.open()
pool_size=section.pool_size, try:
cache_size=section.cache_size, return ZODB.DB(storage,
version_pool_size=section.version_pool_size, pool_size=section.pool_size,
version_cache_size=section.version_cache_size) cache_size=section.cache_size,
version_pool_size=section.version_pool_size,
version_cache_size=section.version_cache_size)
except:
storage.close()
raise
class MappingStorage(BaseConfig): class MappingStorage(BaseConfig):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment