From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73046: 29.4; Emacs 100% CPU usage for several seconds when opening dired buffer over TRAMP Date: Fri, 06 Sep 2024 08:40:45 +0300 Message-ID: <8634md2vc2.fsf@gnu.org> References: <87o75241qh.fsf@gmail.com> <86plpi2ixa.fsf@gnu.org> <87seudke20.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11604"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73046@debbugs.gnu.org To: Suhail Singh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 06 07:44:13 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 1smRlU-0002sa-4q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 06 Sep 2024 07:44:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smRlG-0007kX-Ct; Fri, 06 Sep 2024 01:43:58 -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 1smRlE-0007av-M9 for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 01:43:56 -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 1smRlE-0003FJ-C5 for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 01:43:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=ujYzpKIKVtX+M52pD/a54+YnaZyK3VpS76t2kaAztUI=; b=gxXwICJw7KFkBQetZsxAo/b3LvHH7RS04w+FUzJzlk5x5KBUq2kNW+0wZkd0KoI2VZZXbesM48EHRpJAPFE+C+/jjie5E8iczuexDH6b3Br1J+svPe+JouiBCSQsFAAfStVSpV7ZA22Lw379SFBpAeYx8UOTAwrxuCnZ0FEMcwUk5T9X4YIocOm2O93Lw0DcveWuyVPHLjjTjzlQQuKnINyhJIxBg9a80QtqOuS1PLwjEUdmx0KMcYLVcSAP9qb1yvq5vEFi1y4/oUbYnU6K4uMrLy+Dl6pAvz3hwnCCuMOdFxP7KoXZWZpuMUlNa8lQBzNcKEjxWY65jLYEpTphlA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1smRmH-0000SX-VB for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 01:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Sep 2024 05:45: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.17256014561651 (code B ref 73046); Fri, 06 Sep 2024 05:45:01 +0000 Original-Received: (at 73046) by debbugs.gnu.org; 6 Sep 2024 05:44:16 +0000 Original-Received: from localhost ([127.0.0.1]:38980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smRlX-0000QZ-HU for submit@debbugs.gnu.org; Fri, 06 Sep 2024 01:44:15 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smRlV-0000QG-01 for 73046@debbugs.gnu.org; Fri, 06 Sep 2024 01:44:14 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smRiC-0002zh-1u; Fri, 06 Sep 2024 01:40:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ujYzpKIKVtX+M52pD/a54+YnaZyK3VpS76t2kaAztUI=; b=BG0kZ/GtSBRB 4oxHVfYW8nBEVwkqHWaHdLniL8L9BQYPTJ7HZ6o+BmRlCPXIU+ORJk3kMWRli51k0f7pZqtqcj3/e iZdGM+nch8EexoXU0os4iZpsSNWWDc2Sw+lf03nGuNe+COQrWA01FdbWFHkMRlT81b6+rk54f4yt/ SY2QJQeeCxGYgrXtdDd4nGzxyazfQg6bdQGIHLpQ7/Nji4PfZof7MjYND5M9OC2pO9UzNIFNxvqQ5 lk7dLMwK+0FDZSgdjRLOvbOQYvFfHpF06dCqN9DtPT6HyNNDZ/z+CHO1g6WYm8ur6/e9iY7pa63ze 9MkHxx1CbS2GdpKacAlA/g==; In-Reply-To: <87seudke20.fsf@gmail.com> (message from Suhail Singh on Thu, 05 Sep 2024 17:04:23 -0400) 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:291296 Archived-At: > From: Suhail Singh > Cc: "Suhail Singh" , 73046@debbugs.gnu.org > Date: Thu, 05 Sep 2024 17:04:23 -0400 > > Eli Zaretskii writes: > > >> It would also help if being over a slow connection didn't result in > >> Emacs consuming 100% of the CPU via functions such as > >> `tramp-wait-for-regexp' (based on profiler-report). Could some of this > >> be done asynchronously? > > > > You could probably tell which parts take the time by profiling Emacs > > while it collects the Dired data, using profiler.el. This could give > > clues about the expensive parts. My guess would be that retrieving > > the attributes of the files Dired needs are the reason, but I could be > > wrong. > > Based on =profiler-report=, the following function "chains" consume most of the > CPU: > - `font-lock-fontify-keywords-region' > - tramp-sh-file-name-handler > - tramp-sh-handle-file-truename > - `tramp-wait-for-regexp' > - tramp-sh-handle-file-exists-p > - `tramp-wait-for-regexp' > - tramp-sh-handle-file-directory-p > - `tramp-wait-for-regexp' > - tramp-sh-handle-file-attributes > - `tramp-wait-for-regexp' > > As noted previously, disabling global-font-lock-mode helps. FWIW, I cannot reproduce this: I tried Dired on a remote host with which I have connection that is quite slow, and saw neither high CPU usage nor a significant delay in displaying a Dired buffer. > In related news, one thing I've observed on the affected host is that > the version of `ls' doesn't seem to yield expected output for > `ls --dired'. Specifically, the output of `ls --dired' is the same as > the output of `ls' (i.e., `--dired' gets treated as a no-op). This could indeed explain the problem. However, ... > The version of `ls' on this host is: > > #+begin_quote > ls (GNU coreutils) 8.32 > Copyright (C) 2020 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later . > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. > > Written by Richard M. Stallman and David MacKenzie. > #+end_quote This cannot be true: the --dired option was added to 'ls' way earlier. I have Coreutils 6.9 from 2007 on one of my systems, and --dired is supported there. To see if it is supported, try this: $ ls -al --dired You should see 2 extra lines of output after the listing, each one starting with "//DIRED".