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

Stuart 'Zen' Bishop zen@cs.rmit.edu.au
Thu, 9 Dec 1999 12:58:18 +1100 (EST)


On Wed, 8 Dec 1999, Michel Pelletier wrote:

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

Erm.... shouldn't ZApplicationWrapper have a __del__ method to do this,
just in case? It isn't in there...

Otherwise, you would really need

    try:
	x = Zope.app()
	# ... stuff
	return "Hello World!"
    finally:
	x.close()

-- 
 ___
   //     Zen (alias Stuart Bishop)     Work: zen@cs.rmit.edu.au
  // E N  Senior Systems Alchemist      Play: zen@shangri-la.dropbear.id.au
 //__     Computer Science, RMIT 	 WWW: http://www.cs.rmit.edu.au/~zen