This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: python select() is limited to fds < 64

On 22/03/2011 20:08, Christopher Faylor wrote:
> On Tue, Mar 22, 2011 at 08:53:34PM +0100, V??clav Haisman wrote:
>> Jon TURNEY wrote, On 22.3.2011 20:29:
>>> python seems to be built with the default value of FD_SETSIZE, which is only
>>> 64 on cygwin.
>> Is this not because of the inherent limitation of WaitForMultipleObjects() call?
> Yep.  Without a rewrite, it's a hard limit to Cygwin's select().

Please read my email more closely.  I am not saying "python select() is
limited to waiting on 64 fds or less", I am saying "python select() is limited
to waiting on fd which are less than 64"

Admittedly, the test case isn't the clearest demonstration that this is a
problem, so here's an attempt to clarify:

$ cat

from socket import *
from select import select

fds = []

for i in range(64):
    s = socket(AF_INET, SOCK_STREAM)
    print "selecting on fd", s.fileno()
    select([s], [], [], 0)

$ python
selecting on fd 3
selecting on fd 64
Traceback (most recent call last):
  File "", line 11, in <module>
    select([s], [], [], 0)
ValueError: filedescriptor out of range in select()

The exception occurs on the attempt to wait on a single fd greater than 64.

Note that the python "filedescriptor out of range in select()" exception is
not an error being propagated from select().  Before python calls select() it
converts the sequence to a fd_set, verifying that each fd is less than
FD_SETSIZE, and raising this exception if it is not.

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]