[Zope] Releasing connection into Zope's ZODB

Etienne Labuschagne elabuschagne@gmsonline.co.za
Thu, 20 Feb 2003 18:48:39 +0200


Hi all,

Worker threads in one of my programs get a hook into the ZODB as follows:

zopeRootOb = ZODB.ZApplication.ZApplicationWrapper(DB,
                                     'Application',
                                     OFS.Application.Application,
                                     (), Globals.VersionNameName)()

(
I think the following does the same, but haven't tried it:
zopeRootOb = Zope.app()
)

I get a problem where the above call will block indefinately.

After poking around I found that the blocking happens when 
len(DB._pools[1][0][1]) goes to zero.

Obviously I have used up all the connections into the ZODB causing the lockup.

Is there a way to ensure the "release" of my connection once I am finished, 
or will this happen automatically when zopeRootOb's reference count goes to 
zero (i.e. the function goes out of scope and it gets auto dereferenced)?

I am thinking of waiting for len(DB._pools[1][0][1]) to go higher than zero 
before trying to get a connection, but somehow this feels like hacking.  Is 
there an elegant way to wait for a connection to become available?

Thanks
Etienne