From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20706.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::706]) by sourceware.org (Postfix) with ESMTPS id 398F83858020 for ; Thu, 15 Apr 2021 14:54:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 398F83858020 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cornell.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kbrown@cornell.edu ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bqPi+eCtYSFkDq/sRsKKykN/3XeMHFKE0F+R9CUvotUapZZpaZ2DTGe6GWeVxi7Bl3MqEYOf5C8HevbRGZGadfhW+upubofqQNzPCfwV+meCkxE2IFyRcFApzk/Os9R79HZwDI+XVYCgQvtbx64Hxew+xTcblMGY/BE2yDs0D0DgNolxR6qWID/+8aFrjowuXjPTyqxMScd6NBetTnXEmB+7OKqWsNMDu9gbofylH9BdD1LPL4tEswzM63BD1njp4QYAM2ZMN6wrB8aXNYV9geY16bX+xZcTiBfcsFeads61C3yNTgrI7FCZEDKfOQqHrhPObwkP9V+FCVQltJ04fw== 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=1T37O/ywPQxRPZsT2yOFfPHna5yrNIJZzrstk/gvGr0=; b=Q/Fdy8RwFLHBbRVJ8NNjTYS6zr0yuv/F4E2iE2dnPY/hQxGEZiF0U8ULLQqMA487YflcRm5xyg6NHqXxjdpCI3NZ6PKyBbeq88Q+aeU6rDbMWaYADG5CBj/hTxtV03CkCealWgAcN0gRNeP1a9ASdX7m1jdRd0YnLcjRQqjRYSGadalbR6mGgiZM/121rjspsbhGcAMTQ7cZEEA8ASEJJxHCBZyEWsRgpLqOwnaHgx7kp7WPEI00W0uBEWNntNKWwidPW05uQ4hSMPC2vp8pXIZmuRY46jOh3Eudpru0YEXmS8yUDzBqPJGUPxSvUwmHB7RAAfRL2w9aOB4RPltCmQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornell.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1T37O/ywPQxRPZsT2yOFfPHna5yrNIJZzrstk/gvGr0=; b=ElRoQTtNDhiqLDaaMyrKyeqUlJ4o4nFc1W6YDqE7SLXrE6tKgCVwT+XM/kMTv5mH94QwpoV9HCMEr6SkrR6M/ttG34WLV6UUgrWfRGCp5H84AUGXG4wbgOPU0fy8UYp1qD2l8FQdZ1fiCRWfASDWwP26eIW0O8Y1cZNdYFsjU/k= Authentication-Results: cygwin.com; dkim=none (message not signed) header.d=none;cygwin.com; dmarc=none action=none header.from=cornell.edu; Received: from BN7PR04MB4388.namprd04.prod.outlook.com (2603:10b6:406:f8::19) by BN7PR04MB5300.namprd04.prod.outlook.com (2603:10b6:408:3d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Thu, 15 Apr 2021 14:54:53 +0000 Received: from BN7PR04MB4388.namprd04.prod.outlook.com ([fe80::59f8:fcc4:f07e:9a89]) by BN7PR04MB4388.namprd04.prod.outlook.com ([fe80::59f8:fcc4:f07e:9a89%4]) with mapi id 15.20.4042.018; Thu, 15 Apr 2021 14:54:53 +0000 Subject: Re: Problems with the (new) implementation of AF_UNIX datagram sockets To: cygwin-developers@cygwin.com References: From: Ken Brown Message-ID: <1cfa2d74-eaa4-e3be-9fa5-519952026aef@cornell.edu> Date: Thu, 15 Apr 2021 10:53:27 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [24.194.34.31] X-ClientProxiedBy: CH2PR02CA0020.namprd02.prod.outlook.com (2603:10b6:610:4e::30) To BN7PR04MB4388.namprd04.prod.outlook.com (2603:10b6:406:f8::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.17] (24.194.34.31) by CH2PR02CA0020.namprd02.prod.outlook.com (2603:10b6:610:4e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Thu, 15 Apr 2021 14:54:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e5a9a3fd-b113-46ea-f32e-08d9001e6cff X-MS-TrafficTypeDiagnostic: BN7PR04MB5300: 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: ZQH5/Lr6yUM0u3BpWXqzfFplyYWjyfudbhYoq5TwZpvoAQYk6u8HV20quV1vC9Bcng5nADjnV9my0/N883s+srO8jW4BJ3kSqbYbOpHqtWrz4TBaX2ofS4iHAWxmuy7H/7wQdPdNsOVaDQ+hqCz1N5FNe37hj0f8mHWAhKPCYJ4ytqFuyT7bEVEKsg65VHLrqSGP/qEYciZSG0KpuCZaVufU0UpYMigey+fmnA1PIbnXbICwmzcumwDQrEUvh0m7NViDvypEndtK2HhDXe8DVkaDe9LSYUpwl1POQ0CzzcwuwZ5uCncJkI3baA2+THuPFil/OLF7ZVTjDGzeUTPx8y8UeFOyArDLx3NmGHg86SiXvwfoc4mYgwILKMr+QQuRWq/19FnlD2DcgjmW2DoAh1G3YQ+uTlX1Ul+mGUFm5mykQ9K/YmMBDAQxlf2h3KpSjYk3/qx/FTLLZcq3OpWmtxqaiX5tw+uhw7rzdaIpOO62g8Za2C1xM58bEZE4GpnDIBBSopN55r7JZwUFAFTKthy3jRQCvz3/Q/9TiLdKQFZZFZ8ihSq3PeElK1yUXoCL3/su+35bW7+OSEjbdovkRuHmfR2Oi4hWZuUiSIBa8LMwFcP7rjQP0mikNyzxi1BzpjC6DNbchRAZh6GaWSBYpfsvLtetmEz/PKKG4FCvLMXP6JCrfBC54v8D3fu/prX+f1CoGqGG/WJnVjEgfEHWR/w9U272Id9xhV0iQj0gWNwC3SEBAYDvycTvzJE9NcoF/iiRk3nwvi7IzW4lUJVQOVsy5fMLp2UYZwKyhyGrLas= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN7PR04MB4388.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(396003)(346002)(376002)(39860400002)(956004)(5660300002)(2616005)(966005)(38100700002)(38350700002)(786003)(16526019)(478600001)(26005)(186003)(75432002)(86362001)(31696002)(53546011)(83380400001)(66476007)(316002)(6486002)(8936002)(6916009)(52116002)(31686004)(36756003)(16576012)(2906002)(66556008)(66946007)(8676002)(6666004)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?Windows-1252?Q?4OkgUEqVQcGt9wb9e6tSSF3RUZovlL//oQy10Y/r12C/CESw0wZKE/Qw?= =?Windows-1252?Q?H1NrtngQI1P2nxgRc3EP42uc0VLo7njfGrSNXn4oQOpcmNyQaLCYXVW6?= =?Windows-1252?Q?bkIAMbevhiiKgwHo29HnaShqkbLfFuMCP7RxOqwbc0MYB9aXiT9hfqbS?= =?Windows-1252?Q?nLxH96c7R6bXsdOLjvo/4xir0OIMNgXVeprkDXjW6POf/I/UzcNgXNgY?= =?Windows-1252?Q?lc+v69WCJ5tmpskK/IuhQt8+lKFrOMmpvntdurejgYQJYCH1VsEryhhl?= =?Windows-1252?Q?7hr8aR6xgASHJQDgkV5MtN9mAmUig8rFex2W5ASPFme5lFfP5ssCoXr3?= =?Windows-1252?Q?cYg/VHM0f2MZJxWNh9ty3kG0O0WvnfiHMq2LI5vh8XD/RFmjBGuhp0Aq?= =?Windows-1252?Q?1J3m/u4+yN5gSMQhgiIT3Tj4NlT8EJMkP7BRZkAM9A4s5y293UkhTX5F?= =?Windows-1252?Q?ajUUVCvRJg/MM1BHsRE2KMaZAdW6kMoQe8dN014obICiR1K5pabFjmEm?= =?Windows-1252?Q?0aphUOHUlCUPcOUhKlkhwTzxHBaRJXPrBBv5HEatMpDhygNQcI2IuTBv?= =?Windows-1252?Q?Aw2rmlKt6h8SrfLMzHa/kVLUUHuhF1C7cb9eqYzylUHGJOL+ST3YsviR?= =?Windows-1252?Q?wfHM8ZFlUBqqiiUKKlXXi/g7E+tYAOEWZk/bbk1sFpKIL6kIaI3aqTfk?= =?Windows-1252?Q?+CvoAbOrRdAUMG0pF2v6+fp1ThExX7XBsopVh8xx2lO7yjJdwI6xO8cJ?= =?Windows-1252?Q?LalVMvlkJSkrP5Nv0iKMIEzF6EEinaap69mGA3OKICwpd9Sr+LT9M5Qs?= =?Windows-1252?Q?l5oEMxHjfOj+aTLd/nJaJXnYv+fCaJREM884ugKwYvzAqYBsdM5SmCLc?= =?Windows-1252?Q?nAsMiC98S9lpgqd87GaX1x95DAzh2zDTHPWkS63gxMzwW0evyzQJo/lJ?= =?Windows-1252?Q?0he7vzPozT8mUAOUvGIv3A00YCs5STMqsEB3n4FgKTbtSXM63FdiBo25?= =?Windows-1252?Q?7ePVWs7O4BEwtFVfldtsXk0Sq+Ntnih8yI15X6FOGVWJjQKt5Gii2O4z?= =?Windows-1252?Q?HMUcC0cv5KZgnpjzVg6RzOp1xfMECL6oyTMLsBgKsavHT6B75R2U7WKT?= =?Windows-1252?Q?niMI5OqINmAfViSKFpvp5u6mauemaO2nniTVYbtgYFHaokNf6OVKB9xf?= =?Windows-1252?Q?gdFz/5XXNNXzhh/9naa265Nv2yiS+Wa2eLJb+3ZfIb4xdGF1w+ksiVe3?= =?Windows-1252?Q?+d5ZO+/e4h+/3/WQFp9DgoMI52RBj/5AYPEDwoAcUxfFQMcYnlKRPbO2?= =?Windows-1252?Q?qy9z5fu5dP1koGD8XrQj9udF0kTh9fXGpidplHAmrfg+nJhh1wCnQ910?= =?Windows-1252?Q?0Z1mKwno9MKJUP1ZQ/7RraSP2T7/hjPswxhk71Z0aKWtJxdJh3NCt4BT?= X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: e5a9a3fd-b113-46ea-f32e-08d9001e6cff X-MS-Exchange-CrossTenant-AuthSource: BN7PR04MB4388.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2021 14:54:53.2465 (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: TQU5rd/XTpY6IcpriO0aUv2IIjdIocX/qAyIQXRnv/o2zcR7tjNg6YOi5u/6mPCLJg+N0YAtlt0F8O7QkySp/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR04MB5300 X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, JMQ_SPF_NEUTRAL, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, 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-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Apr 2021 14:55:00 -0000 On 4/15/2021 9:58 AM, Corinna Vinschen wrote: > On Apr 15 09:16, Ken Brown wrote: >> On 4/15/2021 7:49 AM, Corinna Vinschen wrote: >>> On Apr 14 12:15, Ken Brown wrote: >> [...] >>>> 1. Writing will block until a connection to the peer's pipe can be >>>> made. In particular, if there are two consecutive writes with the >>>> same peer, the second one will block until the peer reads the >>>> first message. This happens because the peer's pipe is not >>>> available for the second connection until the peer disconnects the >>>> first connection. This is currently done in recvmsg, >>>> and I don't see a straightforward way to do it anywhere else. >>> >>> I'm a bit puzzeled. The idea for datagrams was to call open/send/close >>> in each invocation of sendmsg. Therefore the pipe should become >>> available as soon as the other peer has sent it's data block. The time >>> a sendmsg has to wait for the pipe being available should be quite short! >> >> Unfortunately, the pipe isn't available until the server disconnects. I >> observed this in practice, and it's also documented at >> >> https://docs.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-disconnectnamedpipe >> >> "The server process must call DisconnectNamedPipe to disconnect a pipe >> handle from its previous client before the handle can be connected to >> another client by using the ConnectNamedPipe function." > > d'oh > >> [...] >>> Another idea might be to implement send/recv on a DGRAM socket a bit >>> like accept. Rather than creating a single_instance socket, we create a >>> max_instance socket as for STREAM socket listeners. The server side >>> accepts the connection at recv and immediately opens another pipe >>> instance, so we always have at least one dangling instance for the next >>> peer. >> >> I thought about that, but you would still have the problem (as in 1 above) >> that the pipe instance isn't available until recv is called. > > There always is at least one instance. Do you mean, two clients are > trying to send while the server is idly playing with his toes? Yes. That was essentially the situation in the test case attached to https://cygwin.com/pipermail/cygwin/2021-April/248210.html It was actually one client sending many messages while the server was playing with his toes, but the effect was the same. Ken