X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 3 Aug 2011 13:03:23 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: python doesn't allow descriptors > 63 in select Message-ID: <20110803110323.GD1791@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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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:04, Reini Urban wrote: > 2011/8/3 Corinna Vinschen: > >  $ 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 > >      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. > > I have a similar limitation in postgresql, and I heard that this is > based on a windows limitation, not any predefined constant. > In postgresql I can max fork 63 worker childs, tested by a configure probe. I don't know why that is, since Cygwin allows 256 children per process. Either way, that's not related to select. Cygwin's select is using a single WaitForMultipleObjects (WFMO) call at the core. This WFMO call is restricted to 63 wait objects. But many object types are handled by a common thread, and only this thread is given to WFMO. So, for instance, all sockets given to select together take only one waitable object in the WFMO call. So far this works for sockets, pipes, fifos, ptys and /dev/log. All other objects take one WFMO slot per descriptor. However, if you restrict your application to 64 objects, you will never be able to use more, even if Cygwin's select supports that already or will support it at one point, depending on the descriptor type. 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