public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: scp stalls on uploading in cygwin 3.5 current master.
Date: Thu, 24 Aug 2023 12:31:31 +0900	[thread overview]
Message-ID: <20230824123131.390b4471915c963425c77608@nifty.ne.jp> (raw)
In-Reply-To: <20230824060502.c4798062cb19d4d35a5633ae@nifty.ne.jp>

On Thu, 24 Aug 2023 06:05:02 +0900
Takashi Yano wrote:
> Hi Corinna,
> 
> After the commit dedbbd74d0a8, "scp file server:." stalls.
> I confirmed this when the "server" is a Linux machine.
> The problem does not occur if it is reverted.
> 
> Could you please have a look?
> 
> commit dedbbd74d0a8f3b7dfae6188321703a47bb8a2b3
> Author: Corinna Vinschen <corinna@vinschen.de>
> Date:   Tue Aug 1 14:22:55 2023 +0200
> 
>     Cygwin: select: workaround FD_WRITE network event handling
>     
>     The FD_WRITE event is a false friend.  It indicates ready to write
>     even if the next send fails with WSAEWOULDBLOCK.  *After* the fact,
>     FD_WRITE will be cleared until sending is again possible, but that
>     is too late for a select/write loop.
>     
>     Workaround that by using the WinSock select function when peeking
>     at a socket and FD_WRITE gets indicated. WinSock select fortunately
>     indicates writability correctly.
>     
>     Fixes: 70e476d27be8 ("(peek_socket): Use event handling for peeking socket.")
>     Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

I'm not sure why at all, however, the following patch seems to
solve the issue.

diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 7b9473849..de5794c9f 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -1790,7 +1790,7 @@ peek_socket (select_record *me, bool)
       if (events & FD_WRITE)
 	{
 	  wfd_set w = { 1, { fh->get_socket () } };
-	  TIMEVAL t = { 0 };
+	  TIMEVAL t = { .tv_sec = 0, .tv_usec = 1 };
 
 	  if (_win32_select (0, NULL, &w, NULL, &t) == 0)
 	    events &= ~FD_WRITE;

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

  reply	other threads:[~2023-08-24  3:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 21:05 Takashi Yano
2023-08-24  3:31 ` Takashi Yano [this message]
2023-08-24  8:59   ` Corinna Vinschen
2023-08-25  8:48     ` Takashi Yano
2023-08-25 10:50       ` Corinna Vinschen
2023-08-25 12:08         ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-08-25 12:23           ` Corinna Vinschen
2023-08-25 13:19             ` Corinna Vinschen
2023-08-25 23:27               ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-08-26 13:52                 ` Corinna Vinschen
2023-08-26 14:15                   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-08-26 14:34                     ` Corinna Vinschen
2023-08-25 19:29         ` Takashi Yano
2023-08-26 14:08           ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-08-26 23:41             ` Takashi Yano
2023-08-28 13:37               ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-08-28 13:46                 ` Takashi Yano
2023-08-28 14:07                   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-08-28 14:20                     ` Takashi Yano

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=20230824123131.390b4471915c963425c77608@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin@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).