[ZODB-Dev] ZODB: Are all handles closed?

Ulla Theiss u.theiss@eurodata.de
Fri, 07 Mar 2003 15:24:41 +0100


Hello Christian,

perhaps an important additional information: I run ZOPE under Windows,
not under UNIX.
Unfortunately I have no idea how to find out there, which handle exactly
is being leaked.

Do you have a hint?

Thanks,
Ulla.


Christian Reis schrieb:
> 
> On Fri, Mar 07, 2003 at 02:21:07PM +0100, Ulla Theiss wrote:
> > We have separated the multiple openings and closings to the following
> > code.
> > It shows the increasing of the handles clearly.
> >
> > Have we forgotten to clear anything or made anything wrong?
> > If not, has anybody an idea, how to fix or work around the problem.
> >
> > ----------------------------------snip------snap---------------------
> > from ZODB import FileStorage, DB
> >
> > for i in range (1,100):
> >     storage=FileStorage.FileStorage("TestZODB.fs")
> >     db = DB(storage)
> >     db.open()
> >     print "Open"
> >     db.close()
> >     print "Close"
> >     storage.close()
> > ----------------------------------snip------snap---------------------
> 
> This could be an fd leak; do you know which handle exactly is being
> leaked? /proc is your friend here..
> 
> > Enother nice behaviour we can achieve with the following code:
> >
> > ----------------------------------snip------snap---------------------
> > from ZODB import FileStorage, DB
> >
> > storage=FileStorage.FileStorage("TestZODB.fs")
> > db = DB(storage)
> >
> > for i in range (1,100):
> >     db.open()
> >     print "Open"
> >     db.close()
> >     print "Close"
> >     storage.close()
> > ----------------------------------snip------snap---------------------
> >
> > It works about seven times. Then the programm hangs completely.
> 
> It's funny that calling db.close() explicitly doesn't free the connection
> to be reused in the connection pool, but see my discussion on the same
> topic here:
> 
> http://mail.zope.org/pipermail/zodb-dev/2003-January/004364.html
> 
> At any rate, I'm pretty sure you shouldn't be calling storage.close() if
> you want to reuse it the next time the loop runs.
> 
> Take care,
> --
> Christian Reis, Senior Engineer, Async Open Source, Brazil.
> http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL