delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/07/01/06:06:19

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 461A6IaU786556
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=MKYUN+Ex
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6379E389908C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1719828376;
bh=kUFySJV0dI2KWCdUxe3jgnvPuTJzV868f53iHXRTX+Q=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=MKYUN+Ex30p4FCoO9Vis/W143JiAluhczlou+dE51Xh5FjoL5BDkV+FhkESsU0Wsg
XH/d55HHNvaRS2CMeJzXZEr2wENuLCbUPX7ui5lDmYzeJkyGuhizEtoQRBQWRdv6xy
zDx8TdVKGe/xU9ex5Cvx1Ub0WfCXEc3CFPQh6Cy4=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 867A3389906E
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 867A3389906E
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719828297; cv=none;
b=ZZplvEPKJDnW9MydgxQ81Kp1tPDwt0RKBH3bP2+ZilsqS9D2JRM0APPEWMiWd5kIXxxiC7q0otPUllgbNHgtuxRJlv5L0wRMmiABQp6ejfkKBFdyDVH5Xui230cOjM2ETonwe1BVvgdSpJL3ELeSxU2Oow7Ri8VLvN2h67od3P0=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1719828297; c=relaxed/simple;
bh=1pu6FJGQrfCIY0h3q+QQUYlO9GQSY4XDFDQddrAx00o=;
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
b=RYUpzeHw2+POjMaePLihEKTQdJ9jp4VNff1vtElru1YEs1KtZcroLNlKQMIl6KGB6kcgrU0yEzlz8/GNb02A64FOfQ39HMijtZu1SNvHUpyVM4lrslCIeQhEQ4L/F2v7HSCdxi2JYedIIOYe/MoHz1tNQoaS5WX4uPnoiEJvz4g=
ARC-Authentication-Results: i=1; server2.sourceware.org
Date: Mon, 1 Jul 2024 19:04:50 +0900
To: cygwin AT cygwin DOT com
Subject: Re: ssh-add -l hangs under cygwin test 3.6.0-0.139.g...
Message-Id: <20240701190450.fa31dbbd5dea1f542686c707@nifty.ne.jp>
In-Reply-To: <20240701174353.8537a05054ecc98d5014a87a@nifty.ne.jp>
References: <bd97f4a1-0298-4422-8594-40f0989d13ce AT SystematicSW DOT ab DOT ca>
<19c300bb-97ff-4dee-be8c-2215b38f0a1c AT gmail DOT com>
<20240630225522 DOT 98d50536be104a7425a97394 AT nifty DOT ne DOT jp>
<20240701174353 DOT 8537a05054ecc98d5014a87a AT nifty DOT ne DOT jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE,
SPF_HELO_PASS, SPF_PASS, TXREP,
WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Mon, 1 Jul 2024 17:43:53 +0900
Takashi Yano wrote:
> On Sun, 30 Jun 2024 22:55:22 +0900
> Takashi Yano wrote:
> > On Sun, 30 Jun 2024 20:33:19 +0900
> > jojelino wrote:
> > > On 6/29/2024 2:39 PM, Brian Inglis via Cygwin wrote:
> > > > Reran cygport --debug upload and command hanging was ssh-add -l!
> > > > 
> > >    296   72109 [main] ssh-add 63275 win32env_to_cygenv: 0xA000232E0: 
> > > TERM_PROGRAM=mintty
> > >    189   72298 [main] ssh-add 63275 win32env_to_cygenv: 0xA00023300: 
> > > TERM_PROGRAM_VERSION=3.7.1
> > > 
> > > I was able to reproduce this problem by entering below command with 
> > > ffmpeg from https://www.gyan.dev/ffmpeg/builds/ , this ffmpeg build 
> > > spams putc. So, without piping its output to `tee', It would not 
> > > possible track down any cause among lengthy trace output.
> > > 
> > > strace mintty -e /bin/timeout 10 sh -c './ffmpeg -h full|& tee'
> > > 
> > > In summary, When `timeout' expires, `timeout' signals SIGHUP to pgrp of 
> > > itself, btw some member of the pgrp may have acquired any of 
> > > synchronization object of some part of cygwin internal when a member 
> > > process of the pgrp did encounter the signal interrupt from `timeout'. 
> > > In my case it was output_mutex of pty.
> > > 
> > >   1565 10693297 [main] timeout 745 kill_pgrp: pid 0, signal 15
> > >   2701 15224348 [main] mintty 744 
> > > fhandler_pty_master::process_slave_output: bytes read 256
> > >   1736 9525442 [sig] sh 746 proc_subproc: args: 4, 1
> > >   3137 6700294 [main] tee 748 fhandler_pty_slave::write: pty5, 
> > > write(0x7FFFFC780, 1024)
> > >   1347 9526789 [sig] sh 746 proc_subproc: clear waiting threads
> > >   2084 15226432 [main] mintty 744 
> > > fhandler_pty_master::process_slave_output: returning 256
> > >   1110 6701404 [main] tee 748 fhandler_pty_slave::write: (1267): pty 
> > > output_mutex (0x4C0): waiti
> > > -1 ms
> > >    732 9527521 [sig] sh 746 checkstate: child_procs count 2
> > >   3648 10696945 [main] timeout 745 open_shared: name cygpid.724, shared 
> > > 0x1A0050000 (wanted 0x1A
> > > 0000), h 0x16C, m 6, created 0
> > >   1055 6702459 [main] tee 748 fhandler_pty_slave::write: (1267): pty 
> > > output_mutex: acquired
> > > 
> > >   2092 15753306 [main] mintty 744 fhandler_pty_master::close: (2095): 
> > > pty output_mutex (0x4AC):
> > > ting -1 ms
> > > 
> > > And below is a location where `tee' did hang.
> > > 
> > > #3  0x00007ffd0e408fdf in fhandler_pty_slave::write (this=0x800009a10,
> > >      ptr=0x7ffffc780, len=<optimized out>)
> > >      at ../../.././winsup/cygwin/fhandler/pty.cc:1268
> > > 1268      if (!process_opost_output (get_output_handle (), ptr, towrite, 
> > > false,
> > > (gdb)  li
> > > 1263      termios_printf ("pty%d, write(%p, %lu)", get_minor (), ptr, len);
> > > 1264
> > > 1265      push_process_state process_state (PID_TTYOU);
> > > 1266
> > > 1267      acquire_output_mutex (mutex_timeout);
> > > 1268      if (!process_opost_output (get_output_handle (), ptr, towrite, 
> > > false,
> > > 1269                                 get_ttyp (), is_nonblocking ()))
> > > 
> > > 
> > > I ended up prepending two CancelIo call just above of 
> > > acquire_output_mutex located in fhandler_pty_master::close of pty.cc.
> > > 
> > >  >	  CancelIo(get_ttyp()->to_master());
> > >  >	  CancelIo(get_ttyp()->to_master_nat());
> > > 	  acquire_output_mutex (mutex_timeout);
> > > 
> > > Hope it helps
> > 
> > I cannot reproduce the issue.
> > 
> > 1) Which cygwin version do you use?
> > 2) Is this really the same problem with the problem original post reported?
> >    (i.e. reproducible with 3.6.0-0.139 and not reproduced with 3.5.3)
> 
> I could reproduce this (the problem reported by jojelino) by:
> mintty -e timeout 1 dash -c 'yes aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | cat'
> 
> This also occurs with cygwin 3.5.3, so it's another problem than Brian reported.
> 
> This does not occur by:
> mintty -e timeout 1 dash -c 'yes aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
> mintty -e timeout 1 tcsh -c 'yes aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | cat'
> script /dev/null -c timeout 1 dash -c 'yes aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | cat'
> 
> I looked into this probelm and found the cause.
> 
> When the child process (timeout) is terminated, mintty seems to stop reading
> pty master even if yes or cat still alive. (Is this right? >> Thomas)
> (This behaviour seems to be a side efect of patch_319(?) in mintty.)
> 
> If the the pipe used to transfer output from pty slave to pty master is full
> due to lack of master reader, WriteFile() to the pipe is blocked. WriteFile()
> cannot be canceled by cygwin signal, therefore, pty slave hangs.
> 
> I'll submit and push a patch to fix this.
> 
> Thanks for finding this issue. >> jojelino

Please test cygwin-3.6.0-0.145.gc4fb5da27876

Cygwin 3.5.4 will come with this fix.

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019