Commit 0fe92131 authored by Shane Hathaway's avatar Shane Hathaway

Fixed a race condition in close callbacks and corrected what may have been

a memory leak in mounted databases.
parent 7d0a92de
......@@ -84,8 +84,8 @@
##############################################################################
"""Database connection support
$Id: Connection.py,v 1.38 2000/09/07 21:53:47 jim Exp $"""
__version__='$Revision: 1.38 $'[11:-2]
$Id: Connection.py,v 1.39 2000/09/21 21:34:31 shane Exp $"""
__version__='$Revision: 1.39 $'[11:-2]
from cPickleCache import PickleCache
from POSException import ConflictError, ExportError
......@@ -242,11 +242,8 @@ class Connection(ExportImport.ExportImport):
def close(self):
self._incrgc() # This is a good time to do some GC
db=self._db
self._db=self._storage=self._tmp=self.new_oid=self._opened=None
self._debug_info=()
db._closeConnection(self)
# Call the close callback
# Call the close callbacks.
for f in self.__onCloseCallbacks:
try: f()
except:
......@@ -254,6 +251,10 @@ class Connection(ExportImport.ExportImport):
LOG('ZODB',ERROR, 'Close callback failed for %s' % f,
error=sys.exc_info())
self.__onCloseCallbacks=()
self._db=self._storage=self._tmp=self.new_oid=self._opened=None
self._debug_info=()
# Return the connection to the pool.
db._closeConnection(self)
def commit(self, object, transaction, _type=type, _st=type('')):
oid=object._p_oid
......
......@@ -84,8 +84,8 @@
##############################################################################
"""Mounted database support
$Id: Mount.py,v 1.5 2000/08/03 19:56:35 shane Exp $"""
__version__='$Revision: 1.5 $'[11:-2]
$Id: Mount.py,v 1.6 2000/09/21 21:34:31 shane Exp $"""
__version__='$Revision: 1.6 $'[11:-2]
import Globals, thread, Persistence, Acquisition
import ExtensionClass, string, time, sys
......@@ -202,6 +202,7 @@ class MountPoint(Persistence.Persistent, Acquisition.Implicit):
# and possibly the database itself.
t = self._v_data
if t is not None:
self._v_data = None
data = t[0]
if getattr(data, '_v__object_deleted__', 0):
# This mount point has been deleted.
......@@ -212,8 +213,8 @@ class MountPoint(Persistence.Persistent, Acquisition.Implicit):
if conn is not None:
try: del conn._mount_parent_jar
except: pass
if conn._db is not None:
conn.close()
self._v_data = None
if self._v_close_db:
# Stop using this database. Close it if no other
# MountPoint is using it.
......
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