From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward500p.mail.yandex.net (forward500p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:110]) by sourceware.org (Postfix) with ESMTPS id 197DB3858C53 for ; Mon, 4 Apr 2022 07:35:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 197DB3858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru Received: from vla5-10833e9cc57f.qloud-c.yandex.net (vla5-10833e9cc57f.qloud-c.yandex.net [IPv6:2a02:6b8:c18:341e:0:640:1083:3e9c]) by forward500p.mail.yandex.net (Yandex) with ESMTP id E1E96F01BB9; Mon, 4 Apr 2022 10:35:01 +0300 (MSK) Received: from vla1-62318bfe5573.qloud-c.yandex.net (vla1-62318bfe5573.qloud-c.yandex.net [2a02:6b8:c0d:3819:0:640:6231:8bfe]) by vla5-10833e9cc57f.qloud-c.yandex.net (mxback/Yandex) with ESMTP id 1C29DDftZX-Z1ganTkN; Mon, 04 Apr 2022 10:35:01 +0300 X-Yandex-Fwd: 2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1649057701; bh=hmc88S6MgbtPB5XH0SQiR0ijrv0ERXMmIhrJvrccu3I=; h=In-Reply-To:Subject:To:From:Message-ID:References:Date:Reply-To; b=tKaVWlD8IQ+zfyvUt5epXuLh57urL+7rFGxOyMsCJpfdMLT+sh3aihNTVAarMVIMg F1YMLMRFGe0ZQw4VB+8FSsF4YCTPqXfFgtchKFOyk2YLLnCqH2J+HwSXW8eV4wb4tv uJ4HrKJx506I8mpFPAkGEKGE+Dkn2n7ntUo8nuC4= Authentication-Results: vla5-10833e9cc57f.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by vla1-62318bfe5573.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id W7n39lrcWi-Z1LKup72; Mon, 04 Apr 2022 10:35:01 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Received: from [192.168.1.10] (HELO daemon2.darkdragon.lan) by daemon2 (Office Mail Server 0.8.12 build 08053101) with SMTP; Mon, 04 Apr 2022 07:25:06 -0000 Date: Mon, 4 Apr 2022 10:25:06 +0300 From: Andrey Repin X-Mailer: The Bat! (v9.3.4) Professional Reply-To: cygwin@cygwin.com Message-ID: <1478129170.20220404102506@yandex.ru> To: Jim Garrison via Cygwin , cygwin@cygwin.com Subject: Re: OpenSSH 8.9p1-1 Connects successfully but then hangs - Killing ssh-agent resolves the issue In-Reply-To: <3ed89752-9676-a668-f63c-1a9b7662d7b5@jhmg.net> References: <3ed89752-9676-a668-f63c-1a9b7662d7b5@jhmg.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_THEBAT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, XM_LIGHT_HEAVY autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2022 07:35:06 -0000 Greetings, Jim Garrison via Cygwin! Replying to the first post to reduce quoting, but I did read the entire thread. > My Cygwin ssh client stopped working... It would successfully connect to > the remote (Debian) host but then hang without displaying the command > prompt. See debug output attached, as well as cygcheck output. > I decided to run setup to see if there was a newer version of openssh. > In preparation for that I always terminate all Cygwin processes because > they will interfere with the update. I killed the ssh-agent process and > on a whim decided to try connecting again. This time it worked. > This would seem to indicate something in ssh-agent is interfering with > the connection. There are no credentials loaded into ssh-agent. I've encountered similar issue with ssh-pageant myself. The explanation (as I see it) is this: At certain point in its lifetime, the agent gets stuck and cease to respond to the requests. SSH attempting to contact the hung agent, the connection thread responds but internal storage is somehow locked and never return any usable info on which the client could meaningfully act. Since neither agent, nor SSH have any guarding code against slow responses in this place, entire system hangs indefinitely. This is how the problem is observed. The following is a pure guesswork (with a workaround). I'm only exclusively observing this issue on my notebook. My guess is when it awakes from hibernation, some internal state is not managed well. The delay in agent response gets increasingly larger until it reaches the point of intolerability. I've made a workaround like the following: _check_agent() { test -f "$HOME/.ssh/agent" && . "$HOME/.ssh/agent" > /dev/null ssh-add -l > /dev/null 2>&1 & sleep 1 if kill -0 $! 2> /dev/null; then echo "$( basename "$0" ): ssh-add: the agent is hung, unable to continue" >&2 exit 1 fi if ! wait $!; then echo "$( basename "$0" ): ssh-add: no identities or unable to contact the agent" >&2 exit 2 fi } What it does is: 1. Run a command to list available keys, detached. 2. Wait a second to let the command complete, if all goes well. 3. Test if a listing command is still around. If it does, assume hung agent and report an error. 4. Also report an error if no keys are registered with agent or agent is dead. -- With best regards, Andrey Repin Monday, April 4, 2022 9:16:49 Sorry for my terrible english...