From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-02.nifty.com (conssluserg-02.nifty.com [210.131.2.81]) by sourceware.org (Postfix) with ESMTPS id A02133858D39 for ; Tue, 21 Dec 2021 00:03:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A02133858D39 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=nifty.ne.jp Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp Received: from Express5800-S70 (v050141.dynamic.ppp.asahi-net.or.jp [124.155.50.141]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 1BL02wCW001799 for ; Tue, 21 Dec 2021 09:02:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 1BL02wCW001799 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1640044978; bh=MVXmJTWPNv6i4v22C9ZagcmxGMYc38uXCJAPtv8bUxk=; h=Date:From:To:Subject:In-Reply-To:References:From; b=vuOWaaR2t81UtbgLjZn5Y0Lll706i0h/1aeg86DL7hnC5McACRBWv6mYzSyfIDXwe ba9+TtFXy6BZ88tAa1MacYVOkdkj37vhWeflZTllwrSrivwGeAoJRxymgdpvdTewAP aGRT8qm6neU30vO+nY06cB6ICRL3X5sz33jwdfnWZwjOh2+EDU0SAmnNJecGeI7sDd p7I7KH9lHLiH6gPFvL+EolcPnsNvuC/g2PCjQ6uFWYNuZOEZd3veC54aeL+l2Cf4En 27pARbDvyXPAGmeoLagsyry1c29qyeNw/g5fqkzqbh3b0VZo6sFmyPa2hoDc17X5tZ aIwoQlpCJVzOQ== X-Nifty-SrcIP: [124.155.50.141] Date: Tue, 21 Dec 2021 09:03:03 +0900 From: Takashi Yano To: cygwin-developers@cygwin.com Subject: Re: thread safety of fhandler_base_overlapped Message-Id: <20211221090303.e191372574b6a4067e996e72@nifty.ne.jp> In-Reply-To: <20211221085813.6113e8f4e9cae4ac33ef4653@nifty.ne.jp> References: <20211221085813.6113e8f4e9cae4ac33ef4653@nifty.ne.jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 21 Dec 2021 00:03:23 -0000 On Tue, 21 Dec 2021 08:58:13 +0900 Takashi Yano wrote: > On Mon, 20 Dec 2021 19:02:56 -0400 > David McFarland wrote: > > I'm seeing a problem where occasionally write() returns EAGAIN on a > > blocking pipe. I believe this happens when multiple threads are writing > > concurrently to the pipe, and the overlapped structure is modified by > > one thread while another one is between calls to WFMO and > > GetOverlappedResult. > > > > I found this change: > > > > ===== > > commit 2a4b1de773e6159ea8197b6fc3f7e4845479b476 > > Author: Corinna Vinschen > > Date: Mon Mar 23 21:06:00 2020 +0100 > > > > Cygwin: serial: use per call OVERLAPPED structs > > > > Sharing the OVERLAPPED struct and event object in there between > > read and select calls in the fhandler might have been a nice > > optimization way back when, but it is a dangerous, not thread-safe > > approach. Fix this by creating per-fhandler, per-call OVERLAPPED > > structs and event objects on demand. > > > > Signed-off-by: Corinna Vinschen > > ===== > > > > which seems to fix a similar problem in fhandler_serial. > > > > Is is possible that this needs to be done for fhandler_base_overlapped > > as well? I'll try using per-call buffers to see if it fixes my problem. > > Pipe code was completely overhauled. Could you please try > the latest developer snapshot? > https://cygwin.com/snapshots/ Sorry, the new pipe code is also available in cygwin 3.3.3. Do you have the problem in the cygwin 3.3.3? -- Takashi Yano