[Zodb-checkins] CVS: ZODB3 - NEWS.txt:

Tim Peters tim.one at comcast.net
Fri Aug 27 15:04:29 EDT 2004

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

Modified Files:
      Tag: Zope-2_7-branch
Log Message:
New ConnectionStateError raised if an attempt to close a Connection occurs
while a transaction involving that Connection has pending changes.
Collector #789 is a starting point for rationale (short course:
POSKeyErrors, both temporary and permanent, can result otherwise).

=== ZODB3/NEWS.txt => ===
--- ZODB3/NEWS.txt:	Wed Aug 25 15:21:09 2004
+++ ZODB3/NEWS.txt	Fri Aug 27 15:04:28 2004
@@ -2,6 +2,36 @@
 Release date: DD-MMM-YYYY
+New exception ConnectionStateError is raised if an attempt is made to close
+a connection while modifications are pending (the connection is involved in
+a transaction that hasn't been abort()'ed or commit()'ed).  Otherwise,
+because Connection objects are reused from a pool, and retain their caches
+across closing and (re)opening, opening a Connection could pick up data
+from a previous, "abandonned" transaction.  In the worst case of this, if a
+subtransaction was abandonned, close+reopen could leave the subtransaction
+changes in cache, but not reflected anywhere in a storage, and POSKeyErrors
+could result.  See Collector issue 789 for one nasty instance of this.
+There are two flavors of ConnectionStateError that may be raised:
+    "Cannot close a connection joined to a transaction"
+    "Cannot close a connection with a pending subtransaction"
+The first kind means that changes are pending outside of a subtransaction.
+The wording is a bit strange in ZODB 3.2; it's phrased this way so that the
+message is the same as in ZODB 3.3, where the wording makes better sense
+(3.3 has a different transaction model, where data managers (like
+Connection) "join" transactions).
+Avoiding the new exception should be easy:  if you start a transaction,
+finish it (do a commit() or an abort() before closing any connections it
+involves.  If you see the new exception in "working" code, that code
+was working by accident before.

More information about the Zodb-checkins mailing list