[PATCH] Cygwin: pipe: Fix 'lost connection' issue in scp

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Mar 5 19:00:33 GMT 2025


On Mar  5 23:34, Takashi Yano wrote:
> When transferring huge file using scp, the "lost connection" error
> sometimes happen. This is due to fhandler_pipe_fifo::raw_write()
> accidentally sends data that is not reported in th return value when
> interrupted by a signal. The cause of the problem is that CancelIo()
> responds success even if NtWriteFile() already sends the data.
> 
> The following testcase using plain Win32 APIs reproduces the issue.
> The output will be something like:
> W: 8589934592
> R: 9280061440
> Much more data was received than the sender thought it had sent.
> [...]
> Addresses: https://cygwin.com/pipermail/cygwin/2025-January/257143.html
> Fixes: 4003e3dfa1b9 ("Cygwin: pipes: always terminate async IO in blocking mode")
> Reported-by: Jay M Martin <jaymmartin_buy@cox.net>
> Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
> ---
>  winsup/cygwin/fhandler/pipe.cc | 28 ++++++++++++++++++++--------
>  winsup/cygwin/release/3.6.0    |  3 +++
>  2 files changed, 23 insertions(+), 8 deletions(-)

Great job, go for it!


Thanks,
Corinna


More information about the Cygwin-patches mailing list