[Twisted-Python] epoll 2.4 kernel

Reuben Hawkins reubenhwk at gmail.com
Thu Sep 11 01:37:07 MDT 2014


Not sure if this is the right mailing list for this....

epoll should *not* be used on 2.4 kernels...

I have 2.4 kernel running on a 32-bit x86 machine and another 2.4
kernel running on 64-bit x64 and I'm having an issue with twisted (via
buildbot).

I can import epoll from select on the 64-bit machine (it *should* fail
but doesn't) and this later causes twisted to fail...

>>> from select import epoll
>>> epoll(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 38] Function not implemented

On the 32-bit machine, however, importing epoll is properly failing...

>>> from select import epoll
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name epoll
>>>

twisted/internet/default.py is hitting this same problem.  It's
incorrectly picking epoll when it shouldn’t because import epoll is
working when it shouldn't.

I 'fixed' the problem on my machine by adding a check method in
epollreactor.py which does this...

def check():
    try:
        epoll(1)
    except IOError:
        return False
    return True

and I import and call the check method in default.py.

An alternate fix can be...

in twisted/internet/default.py

    try:
        if platform.isLinux():
            try:
                from select import epoll
                epoll(1)
                from twisted.internet.epollreactor import install
            except (IOError, ImportError):
                from twisted.internet.pollreactor import install


Any insight would be good.  I had to compile my own Python 2.7.8 on
these old computers...maybe python is incorrectly detecting epoll in
the build process?

Thanks in advance,
Reuben



More information about the Twisted-Python mailing list