[Zope-dev] DB.close() needs to be called

Barry A. Warsaw barry@zope.com
Tue, 12 Nov 2002 14:16:35 -0500


Looks like Toby's recent change to ApplicationManager.py causes
DB.close() to never be called when you hit Shutdown in the Control
Panel.  This is a bad thing for the Berkeley storages because their
.close() must get called or you'll end up with corrupt databases or
worse <wink>.

----------------------------
revision 1.83
date: 2002/11/12 17:19:13;  author: htrd;  state: Exp;  lines: +2 -2
dont close the storages mid-transaction. need to check whether we need to close them at the end of z2.py
----------------------------

"Um, yeah!" would be my answer. :)

So here's a patch to z2.py to fix this.  I won't check this in because
it looks a little ugly to me and I'm not sure what the right fix is,
but we definitely need to fix this before Zope 2.6.1 is released.

-Barry

Index: z2.py
===================================================================
RCS file: /cvs-repository/Zope/z2.py,v
retrieving revision 1.88
diff -u -r1.88 z2.py
--- z2.py	4 Nov 2002 13:33:46 -0000	1.88
+++ z2.py	12 Nov 2002 19:15:51 -0000
@@ -909,5 +909,7 @@
 import Lifetime
 Lifetime.loop()
 code = sys.ZServerExitCode
+import Zope
+Zope.DB.close()
 zLOG.LOG("z2", zLOG.INFO, 'Exiting with code %d' % code )
 sys.exit(code)