public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: EPERM on bind() ?
Date: Tue, 23 Apr 2019 12:46:00 -0000	[thread overview]
Message-ID: <20190423124619.GC30041@calimero.vinschen.de> (raw)
In-Reply-To: <CAOTD34a_LJP5kk==DzkHz89PFjjPFcXWM1eDFVx+4uNf6XbCjw@mail.gmail.com>

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

On Apr 23 14:17, E. Madison Bray wrote:
> Hello,
> 
> I have had some users of the Jupyter Notebook [1] on Cygwin report an
> crash on startup where, when the Notebook server tries to bind() to
> the port it will listen on (TCP 8888) the bind() fails and errno is
> set to EPERM, which is not an expected errno from bind().
> 
> Looking at the Cygwin sources, in net.cc I see that in
> set_winsock_errno, EPERM is returned by default if there is some WSA
> error for which there is no POSIX equivalent mapped.  Fine--EPERM is
> as good as any other fallback I suppose (?) in that it unambiguously
> indicates some unknown WSA error.

This code is as old as it can get.  The Winsock error fallback to EPERM
predates the Cygwin import into the public CVS repo on sourceware.org in
2000, and the pre-2000 ChangeLogs don't mention it.  There's a good
chance the mapping defaults to EPERM since 1996 when the first socket
support was added.

It's probably a good idea to change the default to EACCES, as for other,
non-WinSock errors.

> I'm just wondering if anyone has any idea what might cause such an
> error.

Nobody knows.  The problem is that we only know the POSIX fallback
but not the actual WSOCK error code.

If you can manage to run the server under strace to reproduce the issue,
then there will be an error message in strace along the lines of

"fhandler_socket*.cc:42 - winsock error 12345 -> errno 1"

The point here is to know what winsock error code that actually is.
What we can do then is to map it to a better POSIX error code or
maybe even see if there's a bug in Cygwin.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2019-04-23 12:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 12:17 E. Madison Bray
2019-04-23 12:28 ` E. Madison Bray
2019-04-23 12:48   ` Corinna Vinschen
2019-04-23 13:37     ` E. Madison Bray
2019-04-23 12:46 ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190423124619.GC30041@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).