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: Sun, 08 Sep 2024 12:46:39 -0400 Message-ID: <87ed5u6qkw.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> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16000"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Michael Albinus , suhailsingh247@gmail.com, 73046@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 08 18:49:15 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 1snL69-0003xe-2V for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Sep 2024 18:49:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1snL5w-0006VC-Vd; Sun, 08 Sep 2024 12:49:00 -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 1snL5v-0006Uw-V0 for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2024 12:48:59 -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 1snL5v-0002Jd-Lx for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2024 12:48:59 -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=J09BzghumrnHOjWH+OjEFgvnkg7PRnhOwz3DRcA4Mk0=; b=vyxATi5+9luKxm5SU1yQ6iH/vd0o6zk79Ks1mstO23no8pHNanyHrR7UmErLBdqrZT1tewtK2d3+oO0giZeP9SFi5+HNXsps7u542qimjx+iRFK5R/cMafhfpkP7CWp89lmfG58a/xKlJREcpedDJEyb/c5Rc3JXooZTR3N4lkQa9xO/93B+FHcNAFfi+FFK1wqs/+RllsfdDG8z1gdOEGrjIjPBAxmY5Y59eN8/O7zWlHEKvhvwO5+KOjLopjg9vezdx4+/QJOZPNmHxXE5hHwDqonfKWDGrlk88I1MCi04cM1qJ0QSH6FSbzyVlX+NXLeP2MQUKUlM84cXb0n4ww==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1snL5y-00072p-0w for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2024 12:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Suhail Singh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Sep 2024 16:49: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.172581408226997 (code B ref 73046); Sun, 08 Sep 2024 16:49:01 +0000 Original-Received: (at 73046) by debbugs.gnu.org; 8 Sep 2024 16:48:02 +0000 Original-Received: from localhost ([127.0.0.1]:59964 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snL4z-00071A-9V for submit@debbugs.gnu.org; Sun, 08 Sep 2024 12:48:01 -0400 Original-Received: from mail-oo1-f66.google.com ([209.85.161.66]:52262) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snL4x-00070t-TR for 73046@debbugs.gnu.org; Sun, 08 Sep 2024 12:48:00 -0400 Original-Received: by mail-oo1-f66.google.com with SMTP id 006d021491bc7-5e1d5acb04bso77849eaf.0 for <73046@debbugs.gnu.org>; Sun, 08 Sep 2024 09:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725814011; x=1726418811; 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=J09BzghumrnHOjWH+OjEFgvnkg7PRnhOwz3DRcA4Mk0=; b=U+vicRF0uWyWD2OnpeBXXXMF/4HyQjxz7jt5FhNByhqgZ8gxxEFZc/2ToZKjzj0QTM FH4HQmLcA8ZZRwPxQ2QFZJZIr78b3vWqo2SF30It4VUuCpnRJyy6nJlH8FGfRlOP9aif JKT9T3AGHS2PndPhgC6f34JVhnqU4z/ijebsm8HcIo/vkv0ExNk15M/Rz4Vs40iXdvHu dj8lIcT5VIywVlkH5kVSFd02YJx03I1O+OguH2pBwt1Of77AGLJNel+vIZLswiyV1oY4 KELhJ9GxK8HxO70Ab8qEdGDxu+nWncGe0y+ymgBrnhMiroheibSQ30OFIRrnogRVM5nu qA1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725814011; x=1726418811; 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=J09BzghumrnHOjWH+OjEFgvnkg7PRnhOwz3DRcA4Mk0=; b=saUpDde7hA1Biadw8Xr1OW398zB9unMXKfdYZMbLijVkRUiajV0Prxde55SuVZ/wL2 pjFnW51PRc8Tl855AsO3zWtguU38V3qDcxT9hXpxCsvS62575KzJZvrpGL0dbHi0luzI FVdkdaZnXccOb3015xFe+KmZvsbqjFC2+1nv5lr47TIWU3p8X/Gzm9dtnrvTcw4Pk2HP HAdW1vFfKTA8Q2HPTzbA0HVo0chZpgMpazKUm/RSnQtD49vpkNTuivr6flSeXiX5oBlk PLvvkVYt8rodXL2xuGnGUPCah+W+GvlASuJsyQde3g1vGVzfHHOFscaV1YNJgy+udCWf 1qGQ== X-Forwarded-Encrypted: i=1; AJvYcCXaq89MkK/l1ddgflGt2s/gV/x6Fs6AG6JAhIXuHpIgl+u7zp113LPxWpYrhbkjPG5xPE+XGw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YysodysusqgPZvDqU6jxsPtCKIbOXfg9dCsKCqswbCbO2CcC+qI H0zLXGgivPgAK0EallmvylwCC1mJrYAXG2jrRaxHI+T5FbTXgy2ZHUWSutIX X-Google-Smtp-Source: AGHT+IG+aQ0wfFxQMdBkYdnMLK6Vwj6hmL/xQvuGNsWcjmyTA6dR/qrjkGPcTZpM6qaQds+CNe01Jg== X-Received: by 2002:a05:6358:61c9:b0:1b8:33ef:cc6c with SMTP id e5c5f4694b2df-1b8385ee4e4mr1086442555d.8.1725814010974; Sun, 08 Sep 2024 09:46:50 -0700 (PDT) Original-Received: from gnus ([65.94.70.53]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a9a7a19a5esm141346385a.113.2024.09.08.09.46.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2024 09:46:50 -0700 (PDT) In-Reply-To: <86cylew3tr.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 08 Sep 2024 18:41:20 +0300") 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:291470 Archived-At: Eli Zaretskii writes: >> >> Tramp is in a loop, waiting for results from the remote side. I don't >> >> know how to implement this differently. >> > >> > What kind of loop? Can you point me to the code which loops there? >> >> The umbrella function is tramp-send-command. It sends the command to >> remote via tramp-send-string, and waits then for a proper shell prompt >> via tramp-wait-for-output. The latter function calls >> tramp-wait-for-regexp, which loops using tramp-accept-process-output. > > Did you try either calling accept-process-output with a non-zero > timeout of, say, 5 msec, or inserting a (sit-for 0.005) into the loop > which calls tramp-accept-process-output? > > Waiting for a process to respond should try not to spin without > sleeping for a few milliseconds between polling attempts. A constant delay busy-wait would be better than what's there today. A straightforward exponential back-off (start with something small like 0.005 and double on each "still-waiting" case till something larger like 0.5) could be even better. However, I thought you'd be proposing something like registering a "callback". Out of curiosity, since I am unfamiliar with the relevant Emacs internals, would it not be possible to add a function to the equivalent of `after-change-functions' that processes the output? -- Suhail