X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=uUtNJfPXRPXRJt+QbMq0azj/GJuczu4hG9y3zeC1sJ7W39nVO6ZWp EbReGivwU8/6D03Cu3+SMw3CWV1LwnA2/kNTaSFvDM61W2d7gN6IV22HGuycDNwI Wc1bAEqKQWThBNVNqRgHTGdUMgH1jsytOx6K2WgmTK6wT1STnc2dJs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=EaH3nzGNq5FsJLAXAAOGBwdfQww=; b=cWQUbruGAmInx1VbyyFGz5ePaSou dnroDGFFkoXDNpx0zlyz6q9Fz1yjg+k54GLFNdNfboJFpBObSH8gCu1scUjysQVT uSS4GFZJbGKHMp69QrqwCtqRxnKM67w1VgwcryEJNrfS+K85c6BlshhPic0/t2g6 kvH4zI19bKDHVVg= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 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 Date: Tue, 23 Apr 2019 14:48:10 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: EPERM on bind() ? Message-ID: <20190423124810.GD30041@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT 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) --BI5RvnYi6R4T2M87 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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" -----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--