public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-developers@cygwin.com
Subject: Re: thread safety of fhandler_base_overlapped
Date: Tue, 21 Dec 2021 08:58:13 +0900	[thread overview]
Message-ID: <20211221085813.6113e8f4e9cae4ac33ef4653@nifty.ne.jp> (raw)
In-Reply-To: <vrita6guzxpb.fsf@gmail.com>

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 <corinna@vinschen.de>
> 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 <corinna@vinschen.de>
> =====
> 
> 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/

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

  parent reply	other threads:[~2021-12-20 23:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 23:02 David McFarland
2021-12-20 23:48 ` Ken Brown
2021-12-20 23:58 ` Takashi Yano [this message]
2021-12-21  0:03   ` Takashi Yano
2021-12-21  0:59     ` David McFarland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211221085813.6113e8f4e9cae4ac33ef4653@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin-developers@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).