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:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; q=dns; s=default; b=mvTpkS/ ViASseBXYrnjA6hbPVFroH8LtkOzCiPfd1LUfSgDC9Ayw6TKsk95Emg8dVZL/wXp 2IwnRd9qqLwJzW3nt9ZbmhIwmRZUJAQpEK7f/nlWjmJYD77tlllLZmZ0J74NSoqE g2Jr9NR0QAGspNzmPlJB4zrmhj0GwC/CqxRc= 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:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; s=default; bh=cPBEQBOr5dfpx 0Wpn+lb0zANFdU=; b=FKG7lPWPSrRMSniRt2MMc2BqmwOIeZVlUoom1+gA+Fqsp Uh3a05WP/8bNqKmbkrI5D2TV7SK90VkfpUKmztgx2b/7VFQMg1twqe/94cmE/Ah7 yIVMPTVfv997tJ9hjfcByAFYYiuu+6/iSpLdvyshXof6rSbJ2fZItWZaNEhpGs= 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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=exclusive, madison, broadcast, comparing X-HELO: mail-io1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=LalNaIoHpLCNnZZ4MVQCdL2kIbicyuhI0MnNs6fSPyo=; b=rx7LPKGPnw9ZuWvu2iHq9aaINP44sXIVzsr3U0u9vFTbmVwM7gD2gHIUOVIWJgHXHI wAVz14delJ58wollUlXyU0wUkjKXOS5Sr1hhtSf/Q2S01E94b+rQrLrS0DO4QCMXCS5c H5d1DhFEQKNBbfBdogDiwO1be0ddem7ZW2OX6TN9afosMjHjVqs/oYxEidc4lXBl7nDj LqZFeBVJ/INROp7TAmM6WiHWTmL8bMDBiqgUO1tdPe9f5V1Qe3KkdLA07Xcx4bw634zV qSFFeiFKBz1ETimdL4fVCUOrQJp90XkDY5tCHyBzjZVDXad4+Ta8PHYgFslMsvi4mz55 0bAA== MIME-Version: 1.0 References: In-Reply-To: From: "E. Madison Bray" Date: Tue, 23 Apr 2019 14:28:21 +0200 Message-ID: Subject: Re: EPERM on bind() ? To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes 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/ 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: > WSAEACCES > 10013 > Permission denied.An attempt was made to access a socket in a way forbidden by its access permissions. > An example is using a broadcast address for sendto without broadcast permission being set using > setsockopt(SO_BROADCAST). > Another possible reason for the WSAEACCES error is that when the bind function is called (on Windows NT > 4.0 with SP4 and later), another application, service, or kernel mode driver is bound to the same address > with exclusive access. Such exclusive access is a new feature of Windows NT 4.0 with SP4 and later, and is > implemented by using the SO_EXCLUSIVEADDRUSE option. This appears to be missing from the wsock_errmap table, but should obviously map to EACCES. I'll supply a patch. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple