From: Suhail Singh <suhailsingh247@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Suhail Singh <suhailsingh247@gmail.com>, 73046@debbugs.gnu.org
Subject: bug#73046: 29.4; Emacs 100% CPU usage for several seconds when opening dired buffer over TRAMP
Date: Thu, 05 Sep 2024 17:04:23 -0400 [thread overview]
Message-ID: <87seudke20.fsf@gmail.com> (raw)
In-Reply-To: <86plpi2ixa.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 05 Sep 2024 18:56:33 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
>> From: "Suhail Singh" <suhailsingh247@gmail.com>
>> Date: Thu, 05 Sep 2024 10:24:54 -0400
>>
>>
>> I observe 100% CPU usage for several seconds when invoking dired for a
>> directory on one of the remote machines I connect to. This doesn't seem
>> to happen for another host. The connection to the affected host is
>> slower, and on that host the issue is worse when the directory has
>> several symlinks.
>>
>> To reproduce via =emacs -Q=:
>> - Invoke `find-file' and connect to problematic host over ssh.
>> - Once connection is established, open dired pointing to a directory on
>> the affected host.
>> - Observe bug: it takes _several_ seconds for the dired buffer to show.
>> During that time, Emacs CPU usage is 100%.
>> - Once dired buffer is open, invoke `revert-buffer' and observe issue
>> again.
>>
>> Disabling global-font-lock-mode, makes the situation better.
>>
>> Given that rudimentary font-locking should be possible via, simply, the
>> output of `ls --dired', it is unclear why enabling font-locking makes
>> things so much worse. If there are some aspects of font-locking that
>> perform much worse over a slower connection, it would help if there were
>> a user configuration to disable them.
>>
>> 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.
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). 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 <https://gnu.org/licenses/gpl.html>.
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
--
Suhail
next prev parent reply other threads:[~2024-09-05 21:04 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 14:24 bug#73046: 29.4; Emacs 100% CPU usage for several seconds when opening dired buffer over TRAMP Suhail Singh
2024-09-05 15:56 ` Eli Zaretskii
2024-09-05 21:04 ` Suhail Singh [this message]
2024-09-06 5:40 ` Eli Zaretskii
2024-09-06 13:23 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 13:54 ` Eli Zaretskii
2024-09-06 14:09 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 16:09 ` Eli Zaretskii
2024-09-06 17:47 ` Suhail Singh
2024-09-06 19:08 ` Eli Zaretskii
2024-09-07 0:19 ` Suhail Singh
2024-09-07 1:39 ` Suhail Singh
2024-09-07 6:29 ` Eli Zaretskii
2024-09-07 8:07 ` Suhail Singh
2024-09-07 14:36 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07 15:07 ` Eli Zaretskii
2024-09-07 17:35 ` Suhail Singh
2024-09-08 11:30 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 11:47 ` Eli Zaretskii
2024-09-08 15:26 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 15:41 ` Eli Zaretskii
2024-09-08 16:46 ` Suhail Singh
2024-09-08 17:53 ` Eli Zaretskii
2024-09-10 8:10 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 1:05 ` Suhail Singh
2024-09-11 11:50 ` Eli Zaretskii
2024-09-11 16:29 ` Suhail Singh
2024-09-11 16:38 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 17:25 ` Suhail Singh
2024-09-12 11:48 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 14:13 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 15:56 ` Suhail Singh
2024-09-13 23:17 ` Suhail Singh
2024-09-14 6:24 ` Eli Zaretskii
2024-09-14 14:25 ` Suhail Singh
2024-09-14 14:41 ` Suhail Singh
2024-09-14 15:03 ` Eli Zaretskii
2024-09-14 22:36 ` Suhail Singh
2024-09-15 5:55 ` Eli Zaretskii
2024-09-15 14:23 ` Suhail Singh
2024-09-14 7:07 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-14 14:39 ` Suhail Singh
2024-09-11 14:06 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07 14:22 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07 17:58 ` Suhail Singh
2024-09-08 11:26 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 15:09 ` Suhail Singh
2024-09-08 15:19 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 15:34 ` Suhail Singh
2024-09-08 16:35 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 16:19 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 16:56 ` Suhail Singh
2024-09-06 16:01 ` Suhail Singh
2024-09-06 15:46 ` Suhail Singh
2024-09-06 15:52 ` Suhail Singh
[not found] <87v7yz1sw8.fsf@rutgers.edu>
2024-09-13 15:47 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87seudke20.fsf@gmail.com \
--to=suhailsingh247@gmail.com \
--cc=73046@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).