[Zodb-checkins] CVS: ZODB3/ZODB - Transaction.py:1.39.16.4

Jeremy Hylton jeremy@zope.com
Fri, 1 Nov 2002 17:07:34 -0500


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv6569

Modified Files:
      Tag: ZODB3-deadlock-debug-branch
	Transaction.py 
Log Message:
Fix bug in self.log() call in _commit_errors().  

The bug prevented tpc_abort() from being called, which leads to
deadlock.


=== ZODB3/ZODB/Transaction.py 1.39.16.3 => 1.39.16.4 ===
--- ZODB3/ZODB/Transaction.py:1.39.16.3	Fri Nov  1 15:43:15 2002
+++ ZODB3/ZODB/Transaction.py	Fri Nov  1 17:07:34 2002
@@ -90,8 +90,6 @@
         entered two-phase commit yet, so no tpc_ messages are sent.
         '''
 
-        self.log("abort")
-
         if subtransaction and (self._non_st_objects is not None):
             raise POSException.TransactionError, (
                 """Attempted to abort a sub-transaction, but a participating
@@ -160,7 +158,6 @@
         '''
         if self._objects:
             self.abort(subtransaction, 0)
-        self.log("begin")
         if info:
             info=split(info,'\t')
             self.user=strip(info[0])
@@ -169,8 +166,6 @@
     def commit(self, subtransaction=None):
         'Finalize the transaction'
 
-        self.log("commit %s" % (subtransaction and "sub" or "top"))
-
         objects = self._objects
 
         subjars = []
@@ -252,7 +247,14 @@
                 # in case the cleanup process causes another
                 # exception.
                 t, v, tb = sys.exc_info()
-                self._commit_error(objects, ncommitted, jars, subjars)
+                try:
+                    self._commit_error(objects, ncommitted, jars, subjars)
+                except:
+                    LOG('ZODB', ERROR,
+                        "A storage error occured during transaction "
+                        "abort.  This shouldn't happen.",
+                        error=sys.exc_info())
+                    
                 raise t, v, tb
         finally:
             del objects[:] # clear registered
@@ -326,10 +328,8 @@
             # whether jar in subjars than to make a dict and do has_key.
             for jar in jars:
                 if jar in subjars:
-                    self.log("commit_sub %s" % jar, BLATHER)
                     jar.commit_sub(self)
                 else:
-                    self.log("tpc_begin %s" % jar, BLATHER)
                     jar.tpc_begin(self)
 
     def _commit_objects(self, objects):
@@ -371,8 +371,6 @@
             raise
 
     def _commit_error(self, objects, ncommitted, jars, subjars):
-        self.log("_commit_errors:\n\tn=%d objects=%r\t\njars=%r\n"
-                 "\tsubjars=%r\n" % (ncommitted, objects, jars, subjars))
         # First, we have to abort any uncommitted objects.  The abort
         # will mark the object for invalidation, so that it's last
         # committed state will be restored.
@@ -392,6 +390,7 @@
         for j in jars:
             try:
                 j.tpc_abort(self) # This should never fail
+                self.log("release %s" % j.sortKey(), BLATHER)
             except:
                 LOG('ZODB', ERROR,
                     "A storage error occured during object abort. This "