From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63080 invoked by alias); 23 Apr 2019 12:48:17 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 63030 invoked by uid 89); 23 Apr 2019 12:48:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-102.2 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=submission, wondering, H*F:D*cygwin.com X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.17.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 23 Apr 2019 12:48:13 +0000 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N4Q8u-1gr7AD1a9m-011R2t for ; Tue, 23 Apr 2019 14:48:11 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id C7569A80772; Tue, 23 Apr 2019 14:48:10 +0200 (CEST) Date: Tue, 23 Apr 2019 12:48:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: EPERM on bind() ? Message-ID: <20190423124810.GD30041@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BI5RvnYi6R4T2M87" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019-04/txt/msg00163.txt.bz2 --BI5RvnYi6R4T2M87 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2227 On Apr 23 14:28, E. Madison Bray wrote: > On Tue, Apr 23, 2019 at 2:17 PM 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. > > > > I'm just wondering if anyone has any idea what might cause such an > > error. Some third-party firewall or BLODA? I can't reproduce it > > myself. Trying to bind to a port already in use correctly returns > > EADDRINUSE. > > > > > > [1] https://jupyter.org/ >=20 > Answering my own question after comparing the list on > https://docs.microsoft.com/en-us/windows/desktop/winsock/windows-sockets-= error-codes-2 > to Cygwin's wsock_errmap table this is a likely culprit: >=20 > > WSAEACCES > > 10013 > > Permission denied.An attempt was made to access a socket in a way forbi= dden by its access permissions. > > An example is using a broadcast address for sendto without broadcast pe= rmission being set using > > setsockopt(SO_BROADCAST). > > Another possible reason for the WSAEACCES error is that when the bind f= unction is called (on Windows NT > > 4.0 with SP4 and later), another application, service, or kernel mode d= river is bound to the same address > > with exclusive access. Such exclusive access is a new feature of Window= s NT 4.0 with SP4 and later, and is > > implemented by using the SO_EXCLUSIVEADDRUSE option. >=20 > This appears to be missing from the wsock_errmap table, but should > obviously map to EACCES. I'll supply a patch. Good catch! As I *just* wrote in my other reply, we should better default to EACCES. It should be sufficient to change the default then. I'm looking forward to your patch submission. Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer --BI5RvnYi6R4T2M87 Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAly/CYoACgkQ9TYGna5E T6Aoug//ZXLyjAMB3wZNuU9gPcBezBLwDn6JM41HGHodAMQXXPe/lgb9FZ/Vlfl3 w2Xd0PwVQfZmR/42t/nREjLGVY7Q7l23+M2bRuHvKkEwlAvDnUitIcSoPZOqzelu wFXE6DwZbKe7KhTTWvRmLs2+60VbpFz2RzlDPrsgwHdjH7GU8v3VeZq/qzVsrCcw N1oUWGtZvYyihNDsLwZTMjXWIZdaHnf4FknSngPFJ2GG8XrnGHKgxVeSnQZUtvBF R5kxCAl5ataabsQQ5MJZxxdie6hEgmvF8YZQZ3MYkcUJpT9fKFEo5vPwQKFOH97z xIW1TdykNpxAxXpdUEqabiXVj5wMpx7Kslu7jAwnfLPKaftsqaCimDdXPbFe8Quq /Yg12Tq3HBZrnoAAln0uhqwASp/WiU91cfpfBbg7CDW9JMTsoP7Yr7RBxpN/YYBn hMNc3xMf7Mbtu5OjHUmWFmIEEPHAt5h5MscapghO2IooqG+JJR/BXCY8yRGpAvv2 RKBzgwngtKCGfh9ec9GFIsX7hTV9DpHyWf9EdCdKgKxTqml6/ECTOq91xRHpqRwv wd9ftl3JBBMkbFQupv8l4ipQIRNZcvknGEDKkM4mQT8qmwaw9z+bJca92nZQ97M5 NJWDlWovQHZ0q6pXKgjKTE5nwpxpkKWeIHgFno50SUqQ3CuOIt0= =eQnU -----END PGP SIGNATURE----- --BI5RvnYi6R4T2M87--