[ZODB-Dev] Leaking file descriptors in ZEO tests

Christian Theune ct at gocept.com
Wed Aug 27 10:40:53 EDT 2008


Hi,

I located an issue with leaking file descriptors in the ZEO tests and
have a simple proposal how to fix it. (I can imagine a better way to
exist but can't see one right now.)

Here's what happens:

- The (single) thread in the client process uses a
  ManagedClientConnection.

- The __init__ of ManagedClientConnection's super class causes a trigger
  to be created which will then be replaced with a shared trigger by
  ManagedClientConnection's __init__.

- Unfortunately at this time the trigger that got temporarily created
  won't be garbage collected (or at least the file descriptor won't be),
  as asyncore holds a shared, module-global map of file descriptor
  numbers to file descriptor objects.

I fixed it for me by explicitly closing the trigger in
ManagedClientConnection before replacing it with the shared one.

After that, the number of file descriptors used by the test becomes
stable and my tests for the almost-merged iterator branch can run
successfully.

Christian

-- 
Christian Theune · ct at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 7 · fax +49 345 1229889 1
Zope and Plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20080827/2b7ce078/attachment.bin 


More information about the ZODB-Dev mailing list