[Zope] Releasing connection into Zope's ZODB

Dieter Maurer dieter@handshake.de
Thu, 20 Feb 2003 22:15:12 +0100


Etienne Labuschagne wrote at 2003-2-20 18:48 +0200:
 > 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.

You need to close the connection when you no longer need it:

    zopeRootOb._p_jar.close()

The "_p_jar" is the connection (unless it is "None", in which case
the object is not (yet) persistent).


Dieter