From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from endymion.arp.harvard.edu (endymion.arp.harvard.edu [140.247.179.94]) by sourceware.org (Postfix) with ESMTPS id 61EC03857820 for ; Mon, 30 Nov 2020 17:19:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 61EC03857820 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=huarp.harvard.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=allen@huarp.harvard.edu Received: from [192.168.7.23] (pool-74-104-152-231.bstnma.fios.verizon.net [74.104.152.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by endymion.arp.harvard.edu (Postfix) with ESMTPSA id A46066C095A; Mon, 30 Nov 2020 12:19:09 -0500 (EST) Subject: Re: Unix Domain Socket Limitation? To: Ken Brown Cc: cygwin References: <71490665-31b0-f63c-74da-461a053fac21@huarp.harvard.edu> <55ea1649-1979-6238-75ab-69100c22e069@cornell.edu> <4260ad1b-4ab2-fa36-fd0e-7c9644560114@huarp.harvard.edu> <38a82f82-1ef9-768e-7d3e-15f63147e188@cornell.edu> From: Norton Allen Message-ID: Date: Mon, 30 Nov 2020 12:19:16 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <38a82f82-1ef9-768e-7d3e-15f63147e188@cornell.edu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 17:19:11 -0000 On 11/26/2020 12:13 PM, Ken Brown wrote: > [Adding the Cygwin list back to the Cc.] > > On 11/26/2020 11:27 AM, Norton Allen wrote: >> On 11/25/2020 5:27 PM, Ken Brown via Cygwin wrote: >>> On 11/25/2020 4:47 PM, Norton Allen wrote: >>>> In my recent tests, it appears as though it is not possible to >>>> successfully connect via two Unix Domain sockets from one client >>>> application to one server application. >>>> >>>> Specifically, if I create a server which listens on a Unix Domain >>>> socket and a client, which attempts to connect() twice, both seem >>>> to lock up. This is not the behavior under Linux. >>>> >>>> I will be happy to work up a minimal example if it is helpful in >>>> tracking this down. I wanted to start by asking whether this is a >>>> known limitation and/or if there is something about the Cygwin >>>> implementation that makes this sort of thing very difficult. >>> >>> A minimal example would be extremely helpful. >>> >>> Corinna can answer questions about limitations in the current >>> implementation. But there is a new implementation under development. >>> It's in the topic/af_unix branch of the Cygwin git repository if >>> you're interested in looking at it. >>> >>> Corinna began working on this a couple years ago, and I've recently >>> been trying to finish it.  I've made quite a bit of progress, but >>> there's still more to do and undoubtedly many bugs. So any test >>> cases you have would be very useful. >> >> Thanks Ken, >> >> As it happens, attempting to produce a minimal example suggests my >> problem may be somewhere else. I think I've worked in most of the >> features of my application one by one but have not yet revealed a >> failure. > > OK.  But if you ever do have occasion to write small test programs > involving AF_UNIX sockets, please send them on.  The new AF_UNIX code > needs as much testing as it can get. > I have finally put together a start of a minimal example, although it seems to require a certain level of complexity before tripping on the bug. At the moment, I do not believe the issue is related to having multiple sockets between the client and server. I am thinking it is some sort of race condition related to non-blocking sockets, since I have only observed it when both the client and server are using non-blocking sockets. I have yet to plunge into cygwin.dll, but I think I have reached that point. Here is the code: https://github.com/nthallen/cygwin_unix Since I have only exercised this on my machine, I would be very interested to know if it is reproducible on anyone else's.