DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 45UBYZl0363754 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=v4PkOpaa X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0194C38323FE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1719747274; bh=V22It8DiqGz5Lexk64zolYM6ShEIf6ZCThsx3y7PMnw=; h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=v4PkOpaaJ9P/8MkoqAV9R8HvPXvTJYTugHmUEe3ErIBQWei6tttMhkI2r75Hh3REe leV5XYeZhODSfbtv80f8BOTk80osrprDybMXNL9AqA6sHse4K6EwBKjcq0WHtTRfB6 Xe7LErXn4wi1JWUnO2PoVuaHGX2Lmf35xbkAdi2w= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A1130386547E ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A1130386547E ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719747219; cv=none; b=iRaGaH7fpgVap9kNJ4478YqC0FpPw/sRbV4ojbj6yBH/JanhEm8TPFSa2fRKKgGzb6/blXchFvGpVhxb4S+4GFk73AEXO48O6AmflYwPJ8ixe9DelvX6SXkh2T0pd3+ogklaRDIecQh9kxf31UCBz2X10qy32KV7Vh2m9GlfqYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719747219; c=relaxed/simple; bh=jGLxCXmx3NtZHstvR5aYjg1NOszNYTSmovMp0g62JH0=; h=To:From:Subject:Date:Message-ID:Mime-Version; b=GtaaoBhYYWfhY9a5yzQXhl7jfsnfvDcWSG2fD7qwqwBpjPwQ+RYhiEsnCCuuGnJYgEBTL6ho2H3Xg4vO0KwMx4dpfkYkyG6DM0Pl1ZXcJU3JHk4fDwWmhAUpdQSed4K4/n2GRsVDmSUg84/CSu4jfKanQtTKOyCG7Kd1MVQA49s= ARC-Authentication-Results: i=1; server2.sourceware.org X-Injected-Via-Gmane: http://gmane.org/ To: cygwin AT cygwin DOT com Subject: Re: ssh-add -l hangs under cygwin test 3.6.0-0.139.g... Date: Sun, 30 Jun 2024 20:33:19 +0900 Message-ID: <19c300bb-97ff-4dee-be8c-2215b38f0a1c@gmail.com> References: Mime-Version: 1.0 User-Agent: Thunderbird Daily Content-Language: en-US In-Reply-To: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NML_ADSP_CUSTOM_MED, SPF_HELO_NONE, SPF_PASS, TXREP, WEIRD_PORT autolearn=no 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 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: jojelino via Cygwin Reply-To: jojelino Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" 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=) 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 -- 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