public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin 1.3.3: Win2K: select() returning EBADF (causes thrashing in Boa)
@ 2001-09-20  8:05 Phil Dempster
  2001-09-20  8:32 ` Christopher Faylor
  0 siblings, 1 reply; 5+ messages in thread
From: Phil Dempster @ 2001-09-20  8:05 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 840 bytes --]

I've compiled boa (http//www.boa.org) under Cygwin and it seems to work
(incidentally much better than it did with 1.3.2).

However, the select() call in Boa's main loop continually fails with
errno==EBADF.  Whilst this doesn't actually break it functionally, it does
cause it to thrash taking up 99% CPU time.

            if (select(OPEN_MAX, &block_read_fdset,
                       &block_write_fdset, NULL,
                       (request_block ? &req_timeout : NULL)) == -1) {
                /* what is the appropriate thing to do here on EBADF */
                if (errno == EINTR)
                    continue;   /* while(1) */
                else if (errno != EBADF) {
                    log_error_mesg(__FILE__, __LINE__, "select");
                    exit(errno);
                }
            }

Thoughts?

Regards,
Phil


[-- Attachment #2: cygcheck.out --]
[-- Type: text/x-Algol68, Size: 8074 bytes --]


Cygnus Win95/NT Configuration Diagnostics
Current System Time: Thu Sep 20 15:49:40 2001

WinNT Ver 5.0 build 2195 Service Pack 2

Path:	/usr/local/bin
	/usr/bin
	/bin
	/cygdrive/c/WINNT/system32
	/cygdrive/c/WINNT
	/cygdrive/c/WINNT/System32/Wbem
	/usr/bin
	/cygdrive/c/Progra~1/Rational/ClearCase/bin
	.

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

PWD = `/home/dempster'
CYGWIN = `ntsec tty'
USER = `dempster'
MAKE_MODE = `unix'
HOME = `/home/dempster'

NUMBER_OF_PROCESSORS = `1'
PROMPT = `$P$G'
LOGONSERVER = `\\<SERVER>'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
COMSPEC = `C:\WINNT\system32\cmd.exe'
!C: = `C:\cygwin\bin'
SYSTEMDRIVE = `C:'
HOSTNAME = `CAMPC004'
PROCESSOR_REVISION = `0806'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
COMPUTERNAME = `CAMPC004'
WINDIR = `C:\WINNT'
USERPROFILE = `C:\Documents and Settings\dempster.<DOMAIN>'
HTMLDOC_DATA = `C:\cygwin\usr\local\htmldoc'
PS1 = `\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
PROGRAMFILES = `C:\Program Files'
MACHTYPE = `i686-pc-cygwin'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 8 Stepping 6, GenuineIntel'
WIN32DMIPATH = `C:\DMI\'
OS = `Windows_NT'
OLDPWD = `/usr/local/boa-0.94.9/src'
PROCESSOR_ARCHITECTURE = `x86'
TEMP = `/cygdrive/c/DOCUME~1/DEMPST~1.LSI/LOCALS~1/Temp'
PROCESSOR_LEVEL = `6'
SYSTEMROOT = `C:\WINNT'
HOMEDRIVE = `C:'
ALLUSERSPROFILE = `C:\Documents and Settings\All Users'
SHLVL = `1'
APPDATA = `C:\Documents and Settings\dempster.<DOMAIN>\Application Data'
COMMONPROGRAMFILES = `C:\Program Files\Common Files'
HOMEPATH = `\'
USERDOMAIN = `<DOMAIN>'
USERNAME = `dempster'
SHELL = `/bin/bash'
HOSTTYPE = `i686'
OSTYPE = `cygwin'
TERM = `cygwin'
_ = `/usr/bin/cygcheck'
TZ = `GMTST0GMTDT-1,M3.5.0/1,M10.5.0/2'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x00000022
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/dev/fd0
  (default) = `\\.\a:'
  flags = 0x00000002
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\Cygnus Solutions
  (default) = (unsupported type)
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `C:/cygwin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `C:/cygwin/bin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `C:/cygwin/lib'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options

a:  fd           N/A    N/A                    
c:  hd  NTFS   19085Mb  21% CP CS UN PA FC     PC04_C
d:  cd           N/A    N/A                    
m:  net MVFS    1000Mb  50% CP CS              CCase
s:  net NTFS   12080Mb  63% CP CS    PA        shared
u:  net NTFS   12080Mb  63% CP CS    PA        home
w:  net NTFS    3250Mb  77% CP CS    PA        workspace
y:  net MVFS    1000Mb  50% CP CS              CCase
z:  net MVFS    1000Mb  50% CP CS              CCase

C:\cygwin\bin  /usr/bin  system  binmode
C:\cygwin\lib  /usr/lib  system  binmode
C:\cygwin  /        system  binmode
\\.\a:  /dev/fd0  user    binmode
c:    /cygdrive/c  user    binmode,noumount
m:    /cygdrive/m  user    binmode,noumount
s:    /cygdrive/s  user    binmode,noumount
u:    /cygdrive/u  user    binmode,noumount
w:    /cygdrive/w  user    binmode,noumount
y:    /cygdrive/y  user    binmode,noumount
z:    /cygdrive/z  user    binmode,noumount

Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\sh.exe

   56k 2000/12/03 C:\cygwin\bin\cygbz21.0.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz21.0.dll" v0.0 ts=2000/11/20 23:53
   45k 2001/04/25 C:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/4/25 6:28
   18k 2000/10/23 C:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2000/10/23 3:26
   17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/7 4:34
   21k 2001/06/28 C:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory5.dll" v0.0 ts=2001/6/28 3:27
   21k 2001/06/20 C:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2001/6/20 18:09
   81k 2000/12/05 C:\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitcl30.dll" v0.0 ts=2000/11/26 1:43
   35k 2000/12/05 C:\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitk30.dll" v0.0 ts=2000/11/26 1:43
   45k 2001/07/04 C:\cygwin\bin\cygjbig1.dll - os=4.0 img=1.0 sys=4.0
                  "cygjbig1.dll" v0.0 ts=2001/7/4 4:25
  119k 2001/06/06 C:\cygwin\bin\cygjpeg6b.dll - os=4.0 img=1.0 sys=4.0
                  "cygjpeg6b.dll" v0.0 ts=2001/6/6 5:27
   26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/4/25 6:27
  156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/4/25 6:29
  226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/4/25 6:17
   15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/4/25 6:27
  163k 2001/05/06 C:\cygwin\bin\cygpng2.dll - os=4.0 img=1.0 sys=4.0
                  "cygpng2.dll" v0.0 ts=2001/5/6 5:05
  108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/7 4:34
  135k 2001/06/28 C:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline5.dll" v0.0 ts=2001/6/28 3:27
  390k 2000/12/05 C:\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=2000/11/26 1:39
    5k 2000/12/05 C:\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 2000/12/05 C:\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=2000/11/26 1:39
  245k 2001/06/12 C:\cygwin\bin\cygtiff3.dll - os=4.0 img=1.0 sys=4.0
                  "cygtiff3.dll" v0.0 ts=2001/6/12 18:25
  623k 2000/12/05 C:\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=2000/11/26 1:43
   41k 2001/07/04 C:\cygwin\bin\cygXpm-noX4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-noX4.dll" v0.0 ts=2001/7/4 2:21
   45k 2001/07/04 C:\cygwin\bin\cygXpm-X4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-X4.dll" v0.0 ts=2000/11/20 2:45
   49k 2001/02/03 C:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2001/2/3 20:35
  701k 2001/09/13 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2001/9/13 4:54
    Cygwin DLL version info:
        dll major: 1003
        dll minor: 3
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 46
        shared data: 3
        dll identifier: cygwin1
        mount registry: 2
        cygnus registry name: Cygnus Solutions
        cygwin registry name: Cygwin
        program options name: Program Options
        cygwin mount registry name: mounts v2
        cygdrive flags: cygdrive flags
        cygdrive prefix: cygdrive prefix
        cygdrive default prefix: 
        build date: Wed Sep 12 23:54:31 EDT 2001
        shared id: cygwin1S3

Use -h to see help about each section


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin 1.3.3: Win2K: select() returning EBADF (causes thrashing in Boa)
  2001-09-20  8:05 Cygwin 1.3.3: Win2K: select() returning EBADF (causes thrashing in Boa) Phil Dempster
@ 2001-09-20  8:32 ` Christopher Faylor
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher Faylor @ 2001-09-20  8:32 UTC (permalink / raw)
  To: cygwin

On Thu, Sep 20, 2001 at 04:02:21PM +0100, Phil Dempster wrote:
>I've compiled boa (http//www.boa.org) under Cygwin and it seems to work
>(incidentally much better than it did with 1.3.2).
>
>However, the select() call in Boa's main loop continually fails with
>errno==EBADF.  Whilst this doesn't actually break it functionally, it does
>cause it to thrash taking up 99% CPU time.
>
>            if (select(OPEN_MAX, &block_read_fdset,
>                       &block_write_fdset, NULL,
>                       (request_block ? &req_timeout : NULL)) == -1) {
>                /* what is the appropriate thing to do here on EBADF */
>                if (errno == EINTR)
>                    continue;   /* while(1) */
>                else if (errno != EBADF) {
>                    log_error_mesg(__FILE__, __LINE__, "select");
>                    exit(errno);
>                }
>            }
>
>Thoughts?

The obvious question is why is boa sending a bad fd to select?

What thoughts were you expecting?  You obviously need to debug the code.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin 1.3.3: Win2K: select() returning EBADF (causes thrashing in Boa)
@ 2001-09-21 15:38 Phil Dempster
  0 siblings, 0 replies; 5+ messages in thread
From: Phil Dempster @ 2001-09-21 15:38 UTC (permalink / raw)
  To: cygwin

Heribert,

Thanks very much for that (as usual I was overlooking the obvious).  I
changed OPEN_MAX (256) to _POSIX_OPEN_MAX (16) and that seemed to cure the
problem.

I will maybe look up the book you recommended.

Cheers,
Phil.




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Cygwin 1.3.3: Win2K: select() returning EBADF (causes thrashing in Boa)
@ 2001-09-21 13:46 Heribert Dahms
  0 siblings, 0 replies; 5+ messages in thread
From: Heribert Dahms @ 2001-09-21 13:46 UTC (permalink / raw)
  To: 'Phil Dempster', cygwin

Hi Phil,

your first mail contains the following snippet from boa:

       if (select(OPEN_MAX, &block_read_fdset,

Check if the actual value of OPEN_MAX is larger than
fdset can hold, which may well be platform dependent.
Most efficient would be to use highest_used_fd+1,
if this is handy, or else I'll cite Richard Stevens' famous book
"Advanced Programming in the Unix Environment" (must have IMHO):
	"We could just set the first argument to FD_SETSIZE ..."
at the bottom of p398 in the 7th printing 1994.

Bye, Heribert (heribert_dahms@icon-gmbh.de)

> -----Original Message-----
> From:	Phil Dempster [SMTP:dempster@lsil.com]
> Sent:	Friday, September 21, 2001 09:55
> To:	cygwin@cygwin.com
> Subject:	Re: Cygwin 1.3.3: Win2K: select() returning EBADF (causes
> thrashing in Boa)
> 
> > The obvious question is why is boa sending a bad fd to select?
> 
> My apologies; I omitted to mention that the behaviour differs from the
> same
> code compiled under Linux, where select() correctly blocks.
> 
> As far as I can determine, there is nothing wrong with the file
> descriptor.
> Both block_read_fdset and block_write_fdset are zeroed at initialisation
> (using the FD_ZERO macro).  The server's listening socket is set (using
> FD_SET) in block_read_fdset.  select() does not block and returns
> immediately with errno==EBADF.
> 
> > What thoughts were you expecting?  You obviously need to debug the code.
> 
> I was wondering if there any known issues with the Cygwin implementation
> of
> select(), given that the underlying Microsoft Winsock  function does not
> map
> entirely cleanly to the Berkley implementation.  Your response indicates
> that there are no known issues ;-)
> 
> Cheers,
> Phil.
> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin 1.3.3: Win2K: select() returning EBADF (causes thrashing in Boa)
@ 2001-09-21  0:55 Phil Dempster
  0 siblings, 0 replies; 5+ messages in thread
From: Phil Dempster @ 2001-09-21  0:55 UTC (permalink / raw)
  To: cygwin

> The obvious question is why is boa sending a bad fd to select?

My apologies; I omitted to mention that the behaviour differs from the same
code compiled under Linux, where select() correctly blocks.

As far as I can determine, there is nothing wrong with the file descriptor.
Both block_read_fdset and block_write_fdset are zeroed at initialisation
(using the FD_ZERO macro).  The server's listening socket is set (using
FD_SET) in block_read_fdset.  select() does not block and returns
immediately with errno==EBADF.

> What thoughts were you expecting?  You obviously need to debug the code.

I was wondering if there any known issues with the Cygwin implementation of
select(), given that the underlying Microsoft Winsock  function does not map
entirely cleanly to the Berkley implementation.  Your response indicates
that there are no known issues ;-)

Cheers,
Phil.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-09-21 15:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-20  8:05 Cygwin 1.3.3: Win2K: select() returning EBADF (causes thrashing in Boa) Phil Dempster
2001-09-20  8:32 ` Christopher Faylor
2001-09-21  0:55 Phil Dempster
2001-09-21 13:46 Heribert Dahms
2001-09-21 15:38 Phil Dempster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).