Michel Pelletier <michel@digicool.com> wrote:
-----Original Message----- From: Cayce Ullman [mailto:c_ullman@yahoo.com] Sent: Wednesday, December 08, 1999 11:26 AM To: zope@zope.org; panda@skinnyhippo.com Subject: [Zope] Zope woes continue - server going down regularly. (possible solution)
Alternatively, the server just hangs and doesn't respond (but ps -aux shows the process is running).
Is it spinning? (consuming 100% CPU resources?) or hung? (consuming none..)
I noticed a couple of weeks ago that my Zope, started spinning when I hit a certain page 5 or 6 times. I noticed that this page was different from the others as it tried to do a Zope.app(). This was interesting cause the actual Zope.app() call worked, except it would eventually hose the server. I figured I was just doing something wrong and figured out another way to do it. Anyway, here's how to reproduce the problem :
Create a external method that looks like this :
import Zope
def helloworld(self): x = Zope.app() return "Hello World"
This is because the connection gets opened, but never closed. Zope 2.x is hardwired to have only 7 available database connections. We'll probably add a knob in 2.2 that lets you configure the number of db connections. In either case, the problem is not the hardwiring, the problem is that your code has a bug in it, because you do not free the resource you are consuming. Do an:
x.close()
at the end of your method and you won't run out of connections.
There is stuff in ZODB.ZApplication.py which looks as though it should not be necessary to close a ZODB connection manually: conn=db.open(version) # arrange for the connection to be closed when the request goes away cleanup=Cleanup() cleanup.__del__=conn.close REQUEST._hold(cleanup) Am I misreading this? Or do we have a refcount cycle in here somewhere? -- ================================================================================ Tres Seaver tseaver@palladion.com http://www.palladion.com Palladion Software Houston, Texas, USA 713-523-6582