From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690103.outbound.protection.outlook.com [40.107.69.103]) by sourceware.org (Postfix) with ESMTPS id 287603854807 for ; Fri, 4 Dec 2020 01:11:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 287603854807 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VqOzId0MBXdLhYPquQb+9b6x4nAZDTA9YZ5aa+u/ia5DdnDKPiXMmYfqWdDLnih9Biw0IuCGcLnx3ZyoiCxjE1GkjI1gKRUPzEaMDXWsjlAyXspzcBl35/5VsO7A4uJPmgbOTE4uXW4HjBW4dk5i/cSqgyapbugjoDrO6V3XeZ2LAAedVKGua+Fzv+h2MBoba3UdJnfuhoZC+196E/n2uTLLRAG9U7gdSdEqCvt5VtCh6IIbNFzNubc0oo+efaH3i2uTKfHmW/AL8t6oZF4QIR15aEtP++1LCc/+dhjNGaZ+gQ6LozQWeXQ++xUl7ZgjUd3T4azwW3uZ6YiB97ufRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qPt3zGhdv/PsxscoaVBwJXg/+ibdo5x/clCiX5iQDNE=; b=WWt8xGnk2JcRvBFzFEVEzNbO3kK/Cn2325KV8EQ4n3ol3VJI8ZZ3oe/u/AaP3rXnyy20qDe4fUVo5dHNClON3qS6UX0ngX2UQiPDtarBmFKC/QNvFOCQYqdpvBMqMokKWR2ZqBz0C3gdEbGngOwHUXFofYLuxWa89Vlir+14PvQq+taU6s5qxtQAvcHzt7Ilo3Prsmy12TlYMTWZ4qhBWBf4VAd0l6MbURggmlJMNJqpf2RNt6f4nZKbcguuawJd69DqYzX+iDm7j/V5ncy3aIpwmXx21bc+q7UW3chFiQIRBYP6406zvH56H0GigP1tIpZiqm66H8UY5NTRVP6YeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none Received: from MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) by MN2PR04MB6030.namprd04.prod.outlook.com (2603:10b6:208:dc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17; Fri, 4 Dec 2020 01:11:04 +0000 Received: from MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::113e:c874:1207:eca8]) by MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::113e:c874:1207:eca8%6]) with mapi id 15.20.3611.025; Fri, 4 Dec 2020 01:11:04 +0000 Subject: Re: Unix Domain Socket Limitation? To: Norton Allen , 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> <16165727-f614-1543-70bc-36457ddbf260@cornell.edu> <75d1315b-5a56-a2e5-310d-6ac33a3cf17c@huarp.harvard.edu> <85c9c70f-c016-0f88-099e-5c772adbc648@huarp.harvard.edu> <1a0944b7-5924-31ab-7198-a5c311f39e06@huarp.harvard.edu> From: Ken Brown Message-ID: <1c1e875a-40a0-ff9e-a119-ba77203e43ea@cornell.edu> Date: Thu, 3 Dec 2020 20:11:02 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 In-Reply-To: <1a0944b7-5924-31ab-7198-a5c311f39e06@huarp.harvard.edu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [12.239.146.196] X-ClientProxiedBy: BN6PR03CA0024.namprd03.prod.outlook.com (2603:10b6:404:23::34) To MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [172.20.4.156] (12.239.146.196) by BN6PR03CA0024.namprd03.prod.outlook.com (2603:10b6:404:23::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 01:11:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 03f9e3da-1757-4bfd-8808-08d897f178ec X-MS-TrafficTypeDiagnostic: MN2PR04MB6030: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ol2knHcbq+Ivx1cl/wPns3bTGeMu7nBog2yhR/YP46B0YPOfImdDgr8nVKtruTfsu7cr8XIXNJz9Prqo7uAZLlyWHJwfsikFOVn5kWTr8pUQhRm2keQu/F0SnM4oZrbL238z1+NjQIHfNK4f6vrL4RE5lVFXyOFAx1kfHqoiMJO54Xu04CRXEh0BWHqXpkzjd+agaNftWuOyTaEgCd4aSJRQnwOCOgk/AtZfwL/7GhBhIyaBZh0LkR7un4H1ShLpMDvqkr9TBnKGFYl7V3Ea9aooWMouKaXkJlz399QXC6G9uRJkg0pUqHY10NTK2iTlRu4xPEvxXvt7EqZ43wccoW62lqzTSrphnH7xhJ5+NRboXxzSfZDzz+IMJcNqovbOv+SWpTgEQVLsVArGYqWcily5AFwbG8gN8JLgnZ8+LNxcJeOVjsg+EqMFm/mRk3kSxJidJXT6R5SPfNQLSlQzlML7XEqth4VvBPKPGDiD/QNZW8dT8fvwPWFSzgMq/j58 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR04MB6176.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(366004)(346002)(39860400002)(396003)(16576012)(316002)(8676002)(86362001)(66946007)(31686004)(110136005)(52116002)(53546011)(8936002)(6486002)(5660300002)(83380400001)(31696002)(478600001)(75432002)(2906002)(786003)(956004)(2616005)(66476007)(3480700007)(16526019)(36756003)(966005)(66556008)(186003)(26005)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?Windows-1252?Q?+NfRXTuPD/3zhT3REoSG1FEM1NxJfQNT8L2nA3/+ywDtDpd3eB8B6U8z?= =?Windows-1252?Q?NXLdqO33bpx8FJes2KjidM09iDDfhZ2J3IedKt7HdqSOsa2cPVkVrBJN?= =?Windows-1252?Q?e7F4luYwuGIMbeM7/V9U4XhKerbCHSWW6hx5kaKRWgMDRNogmUCShLSH?= =?Windows-1252?Q?JBdHn8XIwe6LnBM/v/ntdWZkRl0xdglKuoU4WoVf5gi72drhy1HTwYQc?= =?Windows-1252?Q?ge991Fg7i9OkgKjuO+2iyydX4/DIrvXqgYUIs3nk6JCy9F4JXaqsM/Ii?= =?Windows-1252?Q?PoduJgyGG/61ensIlPtkszHYkWunyc73Wpt4Ftb3FX6xL2Gzm2AiYFQ1?= =?Windows-1252?Q?fFXwNrg0HuK8sVRjla7+B6axdyhSlp/TgovHeAsU+ibewLQNjb8GrlSo?= =?Windows-1252?Q?7MocpEjFlbATHkraiDIIq5dNTCPc9qCSFqu1Uk3uEF3E41gJRrVk3g0j?= =?Windows-1252?Q?wzWxbCifvPK844nz/wmedX587oiTNDeNK0W/jVezK56k+g4D3/o1itAP?= =?Windows-1252?Q?RmxMuhG2QwJRRJ2MOxnqKPpWGdCt/F/yy+HfeQ5tiHedj67bdgHwJbU0?= =?Windows-1252?Q?Ugawnxvx7UpDZ87o2jukH25VF0Rwxakd6tufzc2mLrQkBZgX87aKm+3Y?= =?Windows-1252?Q?Vi6N1Ur+HBhXYj/Bg0qPXg2/TxcticdO90m6yRrALySWaS/oQC3Kqb8x?= =?Windows-1252?Q?UlOcLW7sg+pLghGq0WKUrHwxFoZY7014BzuCmmVhMxI6akziiGijsirc?= =?Windows-1252?Q?QXzxnsR59vGlO/Uo/8x/4pIVjxSABfIb5/8i0551rRHYnpp+0kxSdLkB?= =?Windows-1252?Q?A/Wg15vgVSi2uJVxvcySZCofi8puYB2UtypxVnE8kcaehckLUQNxIYMo?= =?Windows-1252?Q?gkpw+yPVYN5iJxDdC2MnJqWG8Kngqe9OSMzSa5F859D6j0Vx+IY2qznc?= =?Windows-1252?Q?+XTKiDMb3TM5bcQgttRojXTqXpDFcSlsJvRayLCIQYmwZTQcmn4MjLRT?= =?Windows-1252?Q?2DxvVfhTF7yN2wPRBxB91MGaSmUJNxuX/XMLBOdE6OTdcY188uKYdz7B?= =?Windows-1252?Q?W3huv1FqefzdHc+W?= X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 03f9e3da-1757-4bfd-8808-08d897f178ec X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB6176.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 01:11:04.6124 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MZRxhp8nsBom8EgCh24CiHJQEIHfPTQnHFhTpSD8jgBcFA0GB6J6DQKXIjwq7eYnCxwliGaWTMzQqHzYEgjH+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB6030 X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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: Fri, 04 Dec 2020 01:11:15 -0000 On 12/2/2020 12:30 PM, Norton Allen wrote: > On 11/30/2020 9:22 PM, Norton Allen wrote: >> Yeah, so now the example no longer blocks for me. Unfortunately these bugs are >> not present in my application, so I will need to keep working on this. >> > > After paring the main application down and back up, I finally narrowed in on the > condition that was causing this blocking behavior. The issue arises when a > client connect()s twice to the same server with non-blocking unix-domain sockets > before calling select(). > > There are a few pieces to this. With the client configured to connect() just > once, I can see that the server's select() returns as soon as the client calls > connect(), but then the server's accept() blocks until the client calls > select(). That is not proper non-blocking behavior, but it appears that the > implementation under Cygwin does require that client and server both be > communicating synchronously to accomplish the connect() operation. > > I tried running this under Ubuntu 16.04 and found that connect() succeeded > immediately, so no subsequent select() is required, and there does not appear to > be a possibility for this collision. That proves to hold true even if the server > is not waiting in select() to process the connect() with accept(). > > A workaround for this issue may be to keep the socket blocking until after > connect(). > > I have pushed the new minimal example program,  'rapid_connects' to > https://github.com/nthallen/cygwin_unix > > The server is run like before as: > >    $ ./rapid_connects server > > The client can be run in two different modes. To connect with just one socket: > >    $ ./rapid_connects client1 > > To connect with two: > >    $ ./rapid_connects client2 > > My immediate strategy will be to develop a workaround for my project. Having > spent a day inside cygwin1.dll, I can see that I have a steep learning curve to > make much of a contribution there. I'm traveling at the moment and unable to do any testing, but I wonder if you're bumping into an issue that was just discussed on the cygwin-developers list: https://cygwin.com/pipermail/cygwin-developers/2020-December/012015.html A different workaround is described there. If it's the same issue, then I don't think it will happen with the new AF_UNIX implementation. More in a few days. Ken