[Checkins] SVN: z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py setting self.storage.engine to None may leak connection (if they are referenced otherwise), disposing them before makes sure the connection gets closed

Michael Howitz mh+zope at gocept.com
Wed Apr 25 05:54:07 EDT 2007


Log message for revision 74742:
  setting self.storage.engine to None may leak connection (if they are referenced otherwise), disposing them before makes sure the connection gets closed
  
  (The problem with leaking connections has bitten us in functional tests of our application.)

Changed:
  U   z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py

-=-
Modified: z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py
===================================================================
--- z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py	2007-04-25 09:31:40 UTC (rev 74741)
+++ z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py	2007-04-25 09:54:05 UTC (rev 74742)
@@ -57,7 +57,9 @@
         return self.storage.engine
 
     def _resetEngine(self):
-        self.storage.engine=None
+        if self.storage.engine is not None:
+            self.storage.engine.dispose()
+            self.storage.engine = None
 
     @property
     def storage(self):



More information about the Checkins mailing list