[Zope] Zope woes continue - server going down regularly. (pos sible solution)

Michel Pelletier michel@digicool.com
Wed, 8 Dec 1999 14:55:22 -0500


> -----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.

-Michel