[Twisted-Python] Another newbie question... out of file descriptors?

K. Richard Pixley rich at noir.com
Thu Feb 25 22:55:28 EST 2010


Can anyone explain this result to me?

It looks to me as though the SelectReactor is leaking file descriptors.  
Granted, it's a pathological case, but it's not uncommon if you're 
running a bunch of tests.

--rich

rich at black.noir.com> cat demo.py
from twisted.internet.selectreactor import SelectReactor

for i in xrange(1024):
    SelectReactor()
rich at black.noir.com> python demo.py
Traceback (most recent call last):
  File "demo.py", line 4, in <module>
    SelectReactor()
  File 
"/home/rich/projects/sprained/sprained-dev/lib/python2.6/site-packages/Twisted-9.0.0_r28543-py2.6-linux-x86_64.egg/twisted/internet/selectreactor.py", 
line 72, in __init__
    posixbase.PosixReactorBase.__init__(self)
  File 
"/home/rich/projects/sprained/sprained-dev/lib/python2.6/site-packages/Twisted-9.0.0_r28543-py2.6-linux-x86_64.egg/twisted/internet/base.py", 
line 471, in __init__
    self.installWaker()
  File 
"/home/rich/projects/sprained/sprained-dev/lib/python2.6/site-packages/Twisted-9.0.0_r28543-py2.6-linux-x86_64.egg/twisted/internet/posixbase.py", 
line 266, in installWaker
    self.waker = _Waker(self)
  File 
"/home/rich/projects/sprained/sprained-dev/lib/python2.6/site-packages/Twisted-9.0.0_r28543-py2.6-linux-x86_64.egg/twisted/internet/posixbase.py", 
line 128, in __init__
    self.i, self.o = os.pipe()
OSError: [Errno 24] Too many open files
rich at black.noir.com> lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu lucid (development branch)
Release:    10.04
Codename:    lucid




More information about the Twisted-Python mailing list