From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Suhail Singh 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 21:39:12 -0400 Message-ID: <87bk10kzsv.fsf@gmail.com> References: <87o75241qh.fsf@gmail.com> <86plpi2ixa.fsf@gnu.org> <87seudke20.fsf@gmail.com> <8634md2vc2.fsf@gnu.org> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2110"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , michael.albinus@gmx.de, 73046@debbugs.gnu.org To: Suhail Singh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 07 03:43:07 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 1smkTj-0000PN-C4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 Sep 2024 03:43:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smkTA-0002aC-32; Fri, 06 Sep 2024 21:42:32 -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 1smkRs-0002Js-L4 for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 21:41:20 -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 1smkRh-0003v3-Ng for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 21:41:06 -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=SaE1ctZPEkNdgX4963OQ7vvQkanj8StS2czSpb04Jzo=; b=SIx11wyY8T5KxC5xHrhJ4VF9aYe7i2VYjL7tEdDcmIXnTOIanMRR0p9AsNAwto+dlN3IqJAxkWmMTBFTeOD0Ub4xLnG0TKy7pwXnclYia72IalQJiXHEscZEWn9O0Bs4DRRJuIY8aJk/cB1E0nYatC2Eqj9L/0DumjqbF/b0POS2RM9rkFBZx/dFYn9xIBQ1HHBp0b31FD/92Z+9VDIeCqhizsDR2UjW1ZxH9VHNhLsl7MIz80EAsEHwfEJefMNZOpj0BC9i4XDMfkWe2rpJFQ6rtMunR6NLVWcxYxq73P9d+n16XW9HACCODR2yOEMMJ0JIG0fsWF9DWOOfWC346w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1smkRh-0006p7-R8 for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 21:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Suhail Singh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Sep 2024 01:41: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.172567323126180 (code B ref 73046); Sat, 07 Sep 2024 01:41:01 +0000 Original-Received: (at 73046) by debbugs.gnu.org; 7 Sep 2024 01:40:31 +0000 Original-Received: from localhost ([127.0.0.1]:54475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smkRD-0006oB-0q for submit@debbugs.gnu.org; Fri, 06 Sep 2024 21:40:31 -0400 Original-Received: from mail-qv1-f66.google.com ([209.85.219.66]:59435) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smkRC-0006nx-2R for 73046@debbugs.gnu.org; Fri, 06 Sep 2024 21:40:30 -0400 Original-Received: by mail-qv1-f66.google.com with SMTP id 6a1803df08f44-6c34c02ff1cso15510356d6.2 for <73046@debbugs.gnu.org>; Fri, 06 Sep 2024 18:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725673164; x=1726277964; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=SaE1ctZPEkNdgX4963OQ7vvQkanj8StS2czSpb04Jzo=; b=mrB9xOx99Vx2V4UpWC5OFghrnsgVcj51Ugo2EnfZzsltsrd72+jlM/SU2pMNZKSl4/ WsI9RXMnr+dm5hcbE++MryVWfHV9K1rCjoDxjYdgQ71GPwwmuok6w25oXXCNxSNwjODa dou/so+WxOGFHYaXZg7ZmoUavVD0NB/aQPV1E1rxdS3c52/vYXSKqr7fdUke8rT4tYAM YKoZKgY5nE3+wk5qW+5a1KOZ6ha1X9y4PL5g0p0v+4DUqThw+4hWHTQOFkbiHNJD7Eak Rv78euy1+gqhWwVfiB38GYcsmPSqdCFZPj19WGFKR5BRY4xTXXOVCxzF3tytt9/Ju+di DplA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725673164; x=1726277964; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SaE1ctZPEkNdgX4963OQ7vvQkanj8StS2czSpb04Jzo=; b=U/SjxJtlsbu+JS6qeVF3dU5s7rmX3LIsdnBP3dC4I7nyqNxY2TKA7bp4GC9k8dQk8i Ib2653WMYtAK+WJP+KCxBgJ/7E+iij3gqdko6sHn64+5wOoH93dVnbV9WARkf/P693hH BegdDEkdMz+FWhK59kOKVyrOwjChZQTqK3M9UejM44fWUYbMcO6UIp8Ht2umekzNyBkc oBlE2FHYKuz9dJDnzZ4yTL5ZKOW/GS5q79jgr3xUCpKrIj5IS2ehHsXyjAcbXqHdsvix x2qwXB0zIwTOcAeDKBmhP76+KC/ETaQD+Uk5R161LU/ozdN6WTlpU8acf3YTOiTir4Qs pHCQ== X-Forwarded-Encrypted: i=1; AJvYcCUBAzGrICuSz8c7jtWULKW4W9nEYMUUEgypQasMFmvorlnhJm7a3U6CuLUVB7h52IATRdtGvA==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzJBTPB1kUk7u2qGvb0v9mMl/5vOLFp7ed9ayIckPLIGuCWZLof R58BMPSY1Px5YWGt3gg+Gj7a4nxPbH6ivnCGKasTreAAXt4Wkhr1d1Ehg+Ap X-Google-Smtp-Source: AGHT+IFLZf6l6UxKZKAOhV4DUYy+M/hvn1ryn0KRo9O6Guciybw4HGoOFOA87++Gfs/6bDZcfooi2Q== X-Received: by 2002:a05:6214:31a1:b0:6c3:5f15:b507 with SMTP id 6a1803df08f44-6c5282fb9cemr61870816d6.3.1725673163506; Fri, 06 Sep 2024 18:39:23 -0700 (PDT) Original-Received: from gnus ([65.94.70.53]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c53474d749sm745706d6.92.2024.09.06.18.39.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 18:39:23 -0700 (PDT) In-Reply-To: <87h6asl3hl.fsf@gmail.com> (Suhail Singh's message of "Fri, 06 Sep 2024 20:19:34 -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:291339 Archived-At: Suhail Singh writes: >>>> It seems to be related to font-locking, indeed. See variable >>>> `dired-font-lock-keywords'. It specifies face recognition running basic >>>> file oprtations. For example, ";; Broken Symbolic link" calls >>>> `file-truename' and `file-exists-p', while "Symbolic link to a directory" >>>> and ";; Symbolic link to a non-directory" invoke `file-truename' and >>>> `file-directory-p'. > ... >>>> I believe it would be helpful to suppress these checks via a user >>>> option. For the benefit of others, absent such a user option, the below code works around the issue: #+begin_src emacs-lisp (add-hook 'dired-mode-hook (lambda () (setq-local dired-font-lock-keywords (cons (list dired-re-sym '(".+" (dired-move-to-filename) nil (0 dired-symlink-face))) (seq-remove (lambda (x) (string= (car x) dired-re-sym)) dired-font-lock-keywords))))) #+end_src I believe that the above isn't a fix, but simply a workaround since TRAMP awaiting a response over a slow connection shouldn't result in 100% CPU usage. Functions such as `tramp-wait-for-regexp' should not be using excess CPU when they are simply awaiting a response. >>>> And no, the checks shouldn't be suppressed for remote directories >>>> in general, on a fast connection they are valuable. For this reason, those interested in working around the issue in a similar manner as above, may want to add additional guards to the hook to ensure that the informative font-locking is suppressed (by modifying dired-font-lock-keywords) only when necessary. -- Suhail