delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/23/07:32:18

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,TW_FD
X-Spam-Check-By: sourceware.org
Message-ID: <4D89DA22.9010404@dronecode.org.uk>
Date: Wed, 23 Mar 2011 11:31:46 +0000
From: Jon TURNEY <jon DOT turney AT dronecode DOT org DOT uk>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: python select() is limited to fds < 64
References: <4D88F89B DOT 6000308 AT dronecode DOT org DOT uk> <4D88FE3E DOT 2070607 AT sh DOT cvut DOT cz> <20110322200804 DOT GA22409 AT ednor DOT casa DOT cgf DOT cx>
In-Reply-To: <20110322200804.GA22409@ednor.casa.cgf.cx>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 select_test_2.py

from socket import *
from select import select

fds = []

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

$ python select_test_2.py
selecting on fd 3
[...]
selecting on fd 64
Traceback (most recent call last):
  File "select_test_2.py", 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:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019