From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73046: 29.4; Emacs 100% CPU usage for several seconds when opening dired buffer over TRAMP Date: Fri, 20 Sep 2024 11:54:28 +0200 Message-ID: <87bk0ik5uz.fsf@gmx.de> References: <87o75241qh.fsf@gmail.com> <87h6asrk42.fsf@gmx.de> <86a5gk28ht.fsf@gnu.org> <87le0450x8.fsf@gmx.de> <865xr8228d.fsf@gnu.org> <87jzfofzcl.fsf@gmail.com> <8634mc1ty0.fsf@gnu.org> <87h6asl3hl.fsf@gmail.com> <86ttesyo1t.fsf@gnu.org> <87bk0zjzt1.fsf@gmx.de> <86a5gjy02i.fsf@gnu.org> <87wmjn2wq5.fsf@gmail.com> <87seuaids7.fsf@gmx.de> <86frqaweo2.fsf@gnu.org> <87a5gigo9b.fsf@gmx.de> <86cylew3tr.fsf@gnu.org> <87r09sexp0.fsf@gmx.de> <87cyl7rvn3.fsf@gmail.com> <86y13uiwhk.fsf@gnu.org> <877cbe48ja.fsf@gmail.com> <86ed5mffbc.fsf@gnu.org> Reply-To: Michael Albinus Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24844"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Suhail Singh , 73046@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 20 11:56:06 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sraMw-0006JI-1V for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 20 Sep 2024 11:56:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sraMb-0000KN-8Z; Fri, 20 Sep 2024 05:55:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sraMZ-0000K5-O0 for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2024 05:55:43 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sraMZ-0001K2-Eu for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2024 05:55:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=tVPP0cu3injvYKr6EnnZiyWg7TQB1VoTkDiGHLPM058=; b=vlWAqkP/QjSi8hZ2m9hw5i7j1N6GBx/lsM9eDtI7cUZBi1DMfXbAIthoFulGg2tQy+8kUwbaNgO6YMT4XCxN05iji1RlIl45N9xSEPFJ89o9+zzIjE/wKJkGZk6VkVmswDyzcWRcYm0eQFFKs/gvJEioegLt9gdJ0sqkUg9DClYnU+zNo43xY+6AjZOkIKNPADI/t/DmV++zrKT04VRS6iGDf3Vk/ADfTMWVv/QsuOR2EWGktTHmlS6OqmYdA3SHwNRwfQWyx818d22uVU9yiyjMyd1956edzKFqr/t9YUYhp2jckuU0P/XUnzctG2CR4978e7ZOhQDwkspr4+v77A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sraMr-0007VY-PQ for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2024 05:56:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Sep 2024 09:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73046 X-GNU-PR-Package: emacs Original-Received: via spool by 73046-submit@debbugs.gnu.org id=B73046.172682611028286 (code B ref 73046); Fri, 20 Sep 2024 09:56:01 +0000 Original-Received: (at 73046) by debbugs.gnu.org; 20 Sep 2024 09:55:10 +0000 Original-Received: from localhost ([127.0.0.1]:34091 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sraM1-0007M7-NE for submit@debbugs.gnu.org; Fri, 20 Sep 2024 05:55:10 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:41043) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sraLx-0007LU-Rw for 73046@debbugs.gnu.org; Fri, 20 Sep 2024 05:55:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1726826075; x=1727430875; i=michael.albinus@gmx.de; bh=tVPP0cu3injvYKr6EnnZiyWg7TQB1VoTkDiGHLPM058=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=DrY7is71aO9SJS1xchOIPGk7Jhur2Dgn79VAubWRdoVdmGAJVnYGGYTJCbZ2W+rm vg1j/al2cl2bU4Z8NCrkR3WQ/c9XqmqFwr3d5Ckn8HtW5oucTBhkdXN+UEv/DIN0X vRfi3/N/0hWCcxRxzs4fngyBLNjwyaSCpFLe0s1CoOz+HnDTLjBn1HXc6FOciUfDZ PAidLrs+d8aCZQaR0L391JQkDa2ru/GpWEPDb1c+bFLD0Uk6BPjxRndAkdn1czV2e XtNycVZZnEaSM1LMN2KauYYkwQkvCt/8snRWbSCspKxJXxycC9BhBHOPDGWHbfyRg RBzwmj0SEDhF4XHkDg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MryTF-1sCncM2ZLZ-00foyT; Fri, 20 Sep 2024 11:54:35 +0200 In-Reply-To: <86ed5mffbc.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Sep 2024 18:03:19 +0300") X-Provags-ID: V03:K1:FBc6lwAUiL4MJyAWqn3wH7pEi8Zx4i8zFX82zVP8hwfc2/uZr2K tni5xsQly3rnUqAAYQgwezuExzdxwKwNGEWAeQcEYRfuDKNOPJJxP8fsvGhGD9LQJvd9t0n 6NctX0CX6FY8iN2VgMNEU1J9KcS8Vg3rLiHQqjQHu82zQjinR2oO440TNmii1FKHkFJ0ATW MyU6Y+LYTLxNSVm498gKg== UI-OutboundReport: notjunk:1;M01:P0:yKbc2D2PFL8=;ARKZss46LYGbbW9vmAO6iQckB5q cxV0m5EiSkwCXDNw0SPvDzM6QpmXuNIA9lUFU7W+MxEdD0gqr02V17RSxgLF0ETUReGUItJgz uv0DWCaXzwXv7xqOdmhkwVcwIO32XlkzmrpKSJislR3bEc12Ghpj1jkbsMcup2kyxFQfOcWuq joHKlB25eAE3qY73BUvDhn/gQovZ9gpYAdmC+8ApGivr1xDnYoIGPkoK8it2rPNtUIboiwW8E R0/WBxdxb7BOVboTqMguzG6GT6BloUPk5JEjY6ivQt9Q8Iks/mYEXoJY4+eOZdMWax69flfM7 ckLnGy4z2tFUwCOou5rk0FnxDK/epCCqHNZtAeY8U+9ig2B7OQKf4sbGQ+cUst9vVGiXHps3p 6CcFP4OM9voJ2VI8C2TwRaU6y+O4WXUPNvFLBrv3Pv2FFDss4HUcZA8eSV77FrXuDDzFrDzyT NFWcZyOakPo0Pchgcenk34qOE7TUvIsvQJf9V6lhx/vokvV2MBkvXNs5ihehCCipU3bqMscqF IP1a04/mEveYYfu24wYMwbm91zh4HjJEqwvsRsFUhT7wTLWT0Pb3NBX1vMOdfaHRlBxnSi7Zl dC+tUQ3J+PQX3iN1SwaWK5bokwqfKYod2EpVBaRegi/RCks/FiR2f9H8lUl4ZLSDCFdQCmcrj KFaOfS+cuw4yOGjmND1+fKOIkvoix/LDh/h/Qi07HRNljK+H+M1f4WtsDlBVtOTcHqv00QUp7 0SyHY7h9ZxYvkWGwM76qzH9YgWw1azQzEjLwBIzreFZ+HV5CuBghRm9Q928l/5VU4FbTXIOk X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292098 Archived-At: Eli Zaretskii writes: Hi, > If 3 surprised you, then the reason is simple: sit-for returns > immediately if any input is available, so typing effectively disables > the wait. This could be countermanded by unconditional sleep, but > AFAIU Michael is rethinking the whole issue, so we should wait for him > to reach his conclusions. > > In any case, interrupting the wait when you type makes sense in > general: it means Emacs is expected to respond sooner, which in most > cases indeed means to stop waiting immediately. I played with the different configurations to use sit-for. The test scenario is simple and can be reproduced with any remote connection, be it slow or fast: --8<---------------cut here---------------start------------->8--- emacs -Q /ssh:remotehost: M-! sleep 30 --8<---------------cut here---------------end--------------->8--- This starts a synchronous remote shell-command, and Tramp must wait for the response in order to return the exit code (akways 9 in this scenario). Observe the Emacs resource consumption by 'top' in another shell. As a second test, I use the Tramp test suite in order to see whether there is performance degradation. It is sufficient to run the test cases tramp-test11-copy-file and tramp-test12-rename-file. make -C test tramp-tests SELECTOR='"11\\|12"' 1. No sit-for call at all, as it has been the case when Suhail reported the problem. Emacs consumes 99% .. 100% CPU. The test suite reports --8<---------------cut here---------------start------------->8--- passed 1/2 tramp-test11-copy-file (1.645027 sec) passed 2/2 tramp-test12-rename-file (2.172439 sec) --8<---------------cut here---------------end--------------->8--- 2. Use (sit-for 0.005) in `tramp-wait-for-regexp', as done initially with my patch. Emacs consumes 42% .. 47% CPU. Good. However, the test suite reports --8<---------------cut here---------------start------------->8--- passed 1/2 tramp-test11-copy-file (5.311830 sec) passed 2/2 tramp-test12-rename-file (4.451581 sec) --8<---------------cut here---------------end--------------->8--- This is a serious performance degradation, which isn't acceptable I believe. 3. Use (sit-for 0.00005) in `tramp-wait-for-regexp', a much shorter timeout. Emacs consumes 72% .. 74% CPU. Not ideal, but better than 100%. The test suite reports --8<---------------cut here---------------start------------->8--- passed 1/2 tramp-test11-copy-file (1.643277 sec) passed 2/2 tramp-test12-rename-file (1.800990 sec) --8<---------------cut here---------------end--------------->8--- This is comparable to the initial values (there's always a small difference). 4. Use (sit-for 0) in `tramp-wait-for-regexp'. Emacs consumes 72% .. 74% CPU, the same as in 3. The test suite reports --8<---------------cut here---------------start------------->8--- passed 1/2 tramp-test11-copy-file (1.562353 sec) passed 2/2 tramp-test12-rename-file (1.626922 sec) --8<---------------cut here---------------end--------------->8--- Seems to be the best compromise, I'm in the mood to apply. Comments? Best regards, Michael.