delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/08/03/07:53:19

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 3 Aug 2011 13:52:21 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: python doesn't allow descriptors > 63 in select
Message-ID: <20110803115221.GE1791@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20110803074950 DOT GH5647 AT calimero DOT vinschen DOT de> <4E393119 DOT 6050809 AT dronecode DOT org DOT uk>
MIME-Version: 1.0
In-Reply-To: <4E393119.6050809@dronecode.org.uk>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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 Aug  3 12:29, Jon TURNEY wrote:
> On 03/08/2011 08:49, Corinna Vinschen wrote:
> >Hi Jason,
> >
> >it looks like there's a build glitch in python:
> >
> >   $ cat>  sel.py<<EOF
> >   from socket import *
> >   from select import select
> >
> >   ins = []
> >
> >   for i in range(1024):
> >       s = socket(AF_INET, SOCK_STREAM)
> >       ins.append(s)
> >       print "socket opened with fd", s.fileno()
> >       select(ins, [], [], 0)
> >   EOF
> >   $ python sel.py
> >   socket opened with fd 3
> >   socket opened with fd 4
> >   socket opened with fd 5
> >   [...]
> >   socket opened with fd 62
> >   socket opened with fd 63
> >   socket opened with fd 64
> >   socket opened with fd 64
> >   Traceback (most recent call last):
> >     File "test.py", line 10, in<module>
> >       select(ins, [], [], 0)
> >   ValueError: filedescriptor out of range in select()
> >
> >I debugged this and it turns out that python does not call Cygwin's
> >select function anymore, as soon as there's a file descriptor in the
> >set which is>= 64.
> >
> >While the default value for FD_SETSIZE is 64 (see /usr/include/sys/types.h):
> >
> >   #  ifndef      FD_SETSIZE
> >   #      define  FD_SETSIZE      64
> >
> >AFAICS the python default for the fd set is 256, see the definition
> >in /usr/include/python2.6/pyport.h:
> >
> >   #ifndef FD_SETSIZE
> >   #define FD_SETSIZE      256
> >
> >But somehow this didn't make it into the python build.  On my Linux
> >box, the same script only stops when it hits the soft descriptor
> >limit, 1024 in my case.
> >
> >Can you have a look and, perhaps, provide a new python with a bigger
> >internal FD_SETSIZE?  The 256 from /usr/include/python2.6/pyport.h
> >would already be ok, I guess, but 512 or so wouldn't hurt either...
> 
> fwiw, I already reported this problem with a patch to fix it at [1].
> 
> [1] http://cygwin.com/ml/cygwin/2011-03/msg00651.html

Indeed.  Huh, even the testcase is the same.  Apparently Jason also
forgot about it.  Jason?  Ping?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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