On Dec 4 10:32, Corinna Vinschen wrote: > Hi guys, > > > I'm not quite sure yet *why* this happens, but this change in > dtable::find_unused_handle... > > On Sep 25 17:26, Eric Blake wrote: > > [...] > > diff --git i/winsup/cygwin/dtable.cc w/winsup/cygwin/dtable.cc > > index 2501a26..c2982a8 100644 > > --- i/winsup/cygwin/dtable.cc > > +++ w/winsup/cygwin/dtable.cc > > @@ -233,7 +233,7 @@ dtable::find_unused_handle (int start) > > if (fds[i] == NULL) > > return i; > > } > > - while (extend (NOFILE_INCR)); > > + while (extend (MAX (NOFILE_INCR, start - size))); > > return -1; > > } > > ...introduced the problem reported in > http://cygwin.com/ml/cygwin/2013-12/msg00072.html > > The problem is still present in the current sources. > > If I apply this change... > > Index: dtable.cc > =================================================================== > RCS file: /cvs/src/src/winsup/cygwin/dtable.cc,v > retrieving revision 1.275 > diff -u -p -r1.275 dtable.cc > --- dtable.cc 1 Dec 2013 19:17:56 -0000 1.275 > +++ dtable.cc 4 Dec 2013 09:26:01 -0000 > @@ -223,7 +223,8 @@ dtable::delete_archetype (fhandler_base > int > dtable::find_unused_handle (size_t start) > { > - size_t extendby = (start >= size) ? 1 + start - size : NOFILE_INCR; > + //size_t extendby = (start >= size) ? 1 + start - size : NOFILE_INCR; > + size_t extendby = NOFILE_INCR; > > /* This do loop should only ever execute twice. */ > int res = -1; > > > ..., which essentially reverts the original change from Eric, the > problem is fixed. > > Off the top of my head I don't understand why Eric's as well as cgf's > solution (which are not equivalent) both introduce this problem, but > always using NOFILE_INCR works, so I publish it here for discussion. > > I'm off for a doc appointment now, maybe I have some clue while sitting > in the anteroom. Not really. Btw., this helps to fix the problem as well: size_t extendby = (start >= size) ? MAX (1 + start - size, NOFILE_INCR) : NOFILE_INCR; Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat