From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#61350: Eglot over Tramp freezes with large project Date: Sun, 26 Feb 2023 18:23:46 +0100 Message-ID: <87cz5wmjbx.fsf@gmx.de> References: <87y1ootw2t.fsf@gmail.com> <69968923.705640.1677163650760@office.mailbox.org> <87a613f0b7.fsf@gmx.de> <87r0udvmzr.fsf@gmx.de> <878rglxrzm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23792"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Thomas Koch , 61350@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 26 18:24:20 2023 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 1pWKl2-00062I-2z for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Feb 2023 18:24:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWKkm-0005rN-Jv; Sun, 26 Feb 2023 12:24:04 -0500 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 1pWKkl-0005r0-6t for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 12:24:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWKkk-0005vP-08 for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 12:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWKkj-0006D0-J6 for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 12:24:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Feb 2023 17:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61350 X-GNU-PR-Package: emacs Original-Received: via spool by 61350-submit@debbugs.gnu.org id=B61350.167743223823852 (code B ref 61350); Sun, 26 Feb 2023 17:24:01 +0000 Original-Received: (at 61350) by debbugs.gnu.org; 26 Feb 2023 17:23:58 +0000 Original-Received: from localhost ([127.0.0.1]:45001 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWKkf-0006Cd-Oe for submit@debbugs.gnu.org; Sun, 26 Feb 2023 12:23:58 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:56409) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWKkc-0006CL-Iz for 61350@debbugs.gnu.org; Sun, 26 Feb 2023 12:23:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1677432228; i=michael.albinus@gmx.de; bh=ph3+wKMWU9K8lADh64dMb95irfMlGGlW1hA3nt851R8=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=TEvLzfkwoDLV+uIFY60RIeLw7ZZ1Mf2RNjrdFXj7+3zTOSCq8A3YTPcSKKJYpCFVJ VJTZU/RrO5xQD8dUsBXHYS9O8/DTTLMUZbzfAbGoS1vS1XWjLw6o4OD0SnIL7pMpKc /y5ePOz369+nISUWuhymUmeBkxJm08v7U9KpPjPJDCFEEu7T2I2f2o7ZKRNuVwGz2l 1kIDczdmyoucOLp65j4oETw7Q4G6dC749uplj7/ZdLSb3MjSMlnM/ei1MjYtAj9Iuq B+lCq5Jd55/FDMNl2dKDX8U2q8UwL/b1h/Ux1gitW4w8rVQTANlH0LFAwCxHxOLp4P M6yMjHVyDWHlQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.22]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N1OXT-1oTghU3XdD-012mZO; Sun, 26 Feb 2023 18:23:47 +0100 In-Reply-To: <878rglxrzm.fsf@gmail.com> ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Sat, 25 Feb 2023 23:09:01 +0000") X-Provags-ID: V03:K1:ECxhSjUOGT+eYJTBvNIWADbV8mEcQ0cBo5e0GnJI8zfIenaMN2K 5uFf+yiGxizHqBbiFypFDELNbrFiCrRfA/CB5S7c97zNV1ZosKPDUR3t34UCGOYTqE4qMCT E8oLXO2z3hKbKZES4S8p/kfOiVcVbznXUwpsw0gYyALJlD/HglZqgE5E/xul+BRSyQ2INDe dTByrWu5UyLE8vAokFuZw== UI-OutboundReport: notjunk:1;M01:P0:iuDp2h2MHIg=;1Pn1QZEEwSWGeNBL7a1KaNBnBQX zHd0f8KN6ES+XYXJAGPqtbG0Cp9iR4NkM5ZoD2maRcCf8F5cc7h3ryeWjnTJBnw+mCt2XkEkK Q9eOdlWcbSxdZznKKzgSplP1OhSav0jzhBo/dXBu2Mcmr6GJfVJRFMWNTHF1vIaf6O4h+R63c 9gCrO3F+PBAvr5XdEjwFsJNzvSJpNob9r85IliJqNRPpAM0XvPPUhcnTt7RS63B3lDMX4eF0Y c0soeAhH/RLq7oUhEIJAjN9uKYpMsb0d26+edaDWJBAcbKxiYqin0yXJ8WMbnQhLGdF0L03RR CdabijXAZc9I6EbGHXxlsUfMsM18JPSqpn8X8MNwNHdGTFMMCkBJJfnDpR31vHPnDTMPlCOta FVCoiJNGWbMq4rEoDOHPp7t0HEUR8FTLotyOL5zUs0d81oHMsYF8qXKNDKXOyZx9NiM97ovjk 6rnvDWoD0uKoqgDp71eAq96lDd2+S+MCa5OHIHtGoFA1MsW6zEC3UdjCWOKuXZDQh16zJrSvp ohnI91TeGfkyUOWOMMY9L3GpRjAg7pmCEs5jQPPTdvFwzC1sVTMn5AmvB5x7pvGBhZIFA/eYm NuD6f9WSoxrgyU9VbvFWCZttZpoZoGwG/IFreqRpzBYXDWfslVRsNFnu7CT1M8ScPr/shvWv0 72lLHSGdJgIduG+WQrzr9mQpKld1YNCXp5cPAJp3A9pX89+qZ+5MFYXwLG+Tqe/CSJbBnR1g3 51GYmvkJu7pze46JePXXaTWO/RrR1L6U9FelDNn619Q7cfhx4MVdtD1FZW2xqDz2mzKGjSwn 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:256825 Archived-At: Jo=C3=A3o T=C3=A1vora writes: Hi Jo=C3=A3o, >> is rather, that Tramp must know where the output to be parsed starts in >> the buffer. > > Right, and this is where 'point' and 'process-mark' come in. Process > mark is where the internal filter last left the insertion, and point is > where you the programmer last left your parsing. Yes, but Tramp doesn't get the whole output with one accept-process-output call. It must use a while loop, until everything it expects has been arrived. So the process-mark also moves again and again, and cannot be used by Tramp directly. >> If another process has consumed the output, even if it is pushed into >> the correct buffer, Tramp doesn't know. > > Why? May I ask -- perhaps naively -- why can't you can't just > > (with-current-buffer proc (=3D (point) (process-mark))) > > to "know"? See above. > In my experience, something like this is usually sufficient. One parses > the buffer for incoming messages looking for regexps, magic byte > sequences, etc. One always leaves point after a successful search > (search-forward-regexp has this behaviour and it's very convenient). > Eventually, point may be left exactly at process-mark, or not, depending > on how much data came in, a full message, multiple full messages, or > some fractional message. > > Regardless, next time you want to get messages from the process, you > perform a check before you go on a potentially blocking call to fetch > more output. The check is usually "has process-mark advanced behind my > back from other libraries I don't control?" Here, jsonrpc.el's a-p-o > calls are the "behing your back". After checking, you know if you have > enough data to form a full message, or if you need to go on a > potentially blocking a-p-o call. Everything correct. But the problem was that not the whole expected output hasn't arrived the buffer. I thought it was "stolen" by another process. But yesterday's debugging has shown, that ssh ControlMaster seems to be guilty; it cannot handle large amount of data reliably. > But somehow I suspect you know all this by heart already!! In fact, > from the backtrace you posted Fri, 17 Feb 2023, it's clear the hang > happend in 'tramp-wait-for-regexp' whic starts=20 > > (defun tramp-wait-for-regexp (proc timeout regexp) > ... > (let ((found (tramp-check-for-regexp proc regexp))) > (cond (timeout > (with-timeout (timeout) > (while (not found) > (tramp-accept-process-output proc) > > Here, exactly how I imaged, you first check for "found" before venturing > into the blocking tramp-accept-process-output call. So it looks to me > that you're doing conceptually the right thing, but it's > tramp-check-for-regexp who is missing the fact that there is a perfectly > good message in process buffer already. At least according to what I > understood from your account of the problem. Yes, that's the place. Tramp waits for a trailing shell prompt that it tells that everything has been sent from remote. But this shell prompt didn't arrive, and Tramp hangs in waiting for this. >> Honestly, I still don't understand really what's up. Let's see whether >> adding threads to Tramp helps. > > I'll try to setup a VM myself with the reproduction recipe that Thomas > used. I'm reasonably confident that two process-based extensions such > as Jsonrpc.el and TRAMP can coeexist if each follows process etiquette. They will cooperate, definitely! > Jo=C3=A3o Best regards, Michael.