Comment 5 for bug 86171

Revision history for this message
Andrew Bennetts (spiv) wrote : Re: Exception in Librarian caused outage

I think this patch will fix the bug in the ZopelessTransactionManager:

=== modified file 'lib/canonical/database/sqlbase.py'
--- lib/canonical/database/sqlbase.py 2007-02-03 19:10:03 +0000
+++ lib/canonical/database/sqlbase.py 2007-02-19 04:18:51 +0000
@@ -336,13 +336,14 @@
         self.set_isolation_level(self.desc.isolation)

     def commit(self):
- self.manager.get().commit()
-
- # We always remove the existing transaction & connection, for
- # simplicity. SQLObject does connection pooling, and we don't have any
- # indication that reconnecting every transaction would be a performance
- # problem anyway.
- self.desc._deactivate()
+ try:
+ self.manager.get().commit()
+ finally:
+ # We always remove the existing transaction & connection, for
+ # simplicity. SQLObject does connection pooling, and we don't have any
+ # indication that reconnecting every transaction would be a performance
+ # problem anyway.
+ self.desc._deactivate()

         if self.implicitBegin:
             self.begin()