delorie.com/archives/browse.cgi | search |
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:from:to:subject:date:message-id:content-type | |
:content-transfer-encoding:mime-version; q=dns; s=default; b=ang | |
cqsuF2bwOTgfPOBELhZ0PY7rVyMEls3mmGdqKaBmnG9yrAU+NztsyG0AZbLCbkys | |
W3By+8hggR0q1RuTrDWuv8CC/jtKefJpmFeTPbE2WNIM17bMGSqE2UqGbxfDuxDD | |
B1UdOSVM9GKL0wBZH71fKunVMYynMQFiqlf3lmDw= | |
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:from:to:subject:date:message-id:content-type | |
:content-transfer-encoding:mime-version; s=default; bh=Hrgd54vQT | |
FXJpJrFCWs2H7FmoLE=; b=rmAvY44lGb4whQSlewackG+FNLIuBH1UWpYCejVBP | |
1zoCjt6pYaYxI8AUJt3k+kG1vqSmTErRgnUHjVb4IiVjmbxbHEYpp2gOD+LK31LY | |
TOcvtc+HqbboiQEBTMoF7PkZxR4ySwkFEsZii/ltbwpWmpcS3/PyUrKu4ldgvwzD | |
B8= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
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-Virus-Found: | No |
X-Spam-SWARE-Status: | No, score=-0.9 required=5.0 tests=AWL,BAYES_00,CYGWIN_OWNER_BODY,GIT_PATCH_2,KAM_INFOUSMEBIZ,KAM_LAZY_DOMAIN_SECURITY,MIME_BASE64_BLANKS,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=H*M:local, H*MI:local, H*F:D*biz, reserved |
X-HELO: | mailrelay.dillinger.de |
From: | "PAULUS, Raimund, TI-ABN" <Raimund DOT Paulus AT dillinger DOT biz> |
To: | "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com> |
Subject: | Re: RPC clnt_create() adress already in use |
Date: | Tue, 6 Feb 2018 11:29:51 +0000 |
Message-ID: | <59D90AF8D70E9740907BACDE2BCB520836E4AA63@RESW102.resdom01.local> |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id w16BU6Yn019789 |
Hello Corinna, with the snapshot of cygwin1.dll and using bindresvport() from Cygwin for libtirpc (instead of the original bindresvport() from libtirpc) all my testcases work without error. Many thanks Raimund -----Ursprüngliche Nachricht----- Von: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] Im Auftrag von Corinna Vinschen Gesendet: Montag, 5. Februar 2018 21:15 An: cygwin AT cygwin DOT com Betreff: Re: RPC clnt_create() adress already in use On Feb 5 15:06, Corinna Vinschen wrote: > On Feb 5 14:34, Corinna Vinschen wrote: > > On Feb 5 12:26, Corinna Vinschen wrote: > > > To reiterate the problem we observe: > > > > > > - socket() > > > - setsockopt (SO_REUSEADDR) > > > - bind() succeeds > > > - connect() fails with EADDRINUSE while socket is still in > > > TIME_WAIT > > > > > > using bindresvport in place of bind only marginally changes the > > > situation, in particular if the second parameter is set and > > > requests a port number != 0. What happens in that case is that > > > bindresvport calls bind with this port number and checks if bind returns EADDRINUSE. > > > > > > Only then it tries to bind other port numbers in the reserved range. > > > But we now know that bind will never return EADDINUSE if the > > > SO_REUSEADDR socket option has been set. > > > > > > Even assuming the process calls bindresvport(sock, NULL) we may > > > end up returning a port number already in use if the process is > > > the only Cygwin process on the system. The reason is that Cygwin > > > uses a round robin approach which relies on having a globally > > > shared value called last_used_bindresvport. If the process is the > > > only Cygwin process on the system, this information is lost after > > > exiting the process, so the next process will start with the same > > > start port number and bind will again fail to notice the client with EADDRINUSE. > > > > > > What potential solutions to this problem do we have? > > > > > > - bindresvport could enforce SO_EXCLUSIVEADDRUSE temporarily to make > > > sure bind fails. > > > > Nope, no way. Even enforcing SO_EXCLUSIVEADDRUSE results in the > > second bind succeeding and the subsequent connect failing. The > > entire SO_REUSEADDR/SO_EXCLUSIVEADDRUSE semantics only works as > > desired on the server side apparently > > > > > - bindresvport could check every local address for being free prior > > > to calling bind. However, there's a potential race here. > > > > > > - DisconnectEx? Never tried this Winsock extension but it might be > > > worth a shot. > > I think I have a very simple solution for the scenario which calls > bindresvport with port number. Still looking for a solution for the > second problem... I've pushed a few patches and uploaded new developer snapshots to https://cygwin.com/snapshots. Please give them a try. Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |