From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thomas Koch Newsgroups: gmane.emacs.bugs Subject: bug#61350: Eglot over Tramp freezes with large project Date: Sun, 5 Mar 2023 13:45:49 +0200 (EET) Message-ID: <54377687.213790.1678016749459@office.mailbox.org> References: <87y1ootw2t.fsf@gmail.com> <69968923.705640.1677163650760@office.mailbox.org> <87a613f0b7.fsf@gmx.de> <87r0udvmzr.fsf@gmx.de> <878rglxrzm.fsf@gmail.com> <87cz5wmjbx.fsf@gmx.de> <87h6v8f7u9.fsf@gmail.com> <87o7pflfcd.fsf@gmx.de> <87wn43e9ht.fsf@gmail.com> <874jr6oont.fsf@gmx.de> <87sfeqd4zi.fsf@gmail.com> <877cw1swjm.fsf@gmx.de> <87k0016dgo.fsf@gmx.de> <1458446553.50372.1677606917251@office.mailbox.org> <87ilfkh89k.fsf@gmail.com> <87y1ofct83.fsf@gmx.de> <87356n8kja.fsf@gmail.com> <877cvvfnp6.fsf@gmx.de> 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="27692"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61350@debbugs.gnu.org To: Michael Albinus , =?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 Mar 05 12:47:39 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 1pYmq2-00072Z-Oc for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Mar 2023 12:47:39 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYmpj-00023i-Bv; Sun, 05 Mar 2023 06:47:20 -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 1pYmpU-00021i-Lv for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2023 06:47:08 -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 1pYmpS-0001xe-Iv for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2023 06:47:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pYmpS-0003jT-2y for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2023 06:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thomas Koch Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Mar 2023 11:47:02 +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.167801676214262 (code B ref 61350); Sun, 05 Mar 2023 11:47:02 +0000 Original-Received: (at 61350) by debbugs.gnu.org; 5 Mar 2023 11:46:02 +0000 Original-Received: from localhost ([127.0.0.1]:38633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYmoT-0003he-Hn for submit@debbugs.gnu.org; Sun, 05 Mar 2023 06:46:02 -0500 Original-Received: from mout-p-102.mailbox.org ([80.241.56.152]:36382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYmoQ-0003hJ-K1 for 61350@debbugs.gnu.org; Sun, 05 Mar 2023 06:45:59 -0500 Original-Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4PV0Jt2Dblz9sZ1; Sun, 5 Mar 2023 12:45:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koch.ro; s=MBO0001; t=1678016750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1SBDWyTqjnXUhcqRe3oyRSVuLp/O5ROeZ7Zp7ZfE3nA=; b=TnEiIzIx6t0bprVNQ2oCEB3SjYFTeVwRw0OhDjloQJM/BsccFSHwValwXiX0FbIJ3xh2rh Bzc+v0S+hQqqBKwPGoRg4xbM0OaF0jkG4gr3apIRxjfA6uzelr4Gvay3mQSd9LL1IMRiSV VpTQiv0spWMl/DwVkTo+B+t8TARnNCvCFcc6BFX2cc8Z3seIz1uJh4F8+J03XJ1p4+vZY1 9PewhlY7kKRlM4y4CNrjIV6oNkwVZgd6GOM4ITYOXGdI3Xv72noG+AbPZxvir6SQCRGvqw jGQ8xGrbn0o5P9OqqwZYE/uD6+Z1K46FmXxam9JyvlIXuHjwSpBngZheNVFHbg== In-Reply-To: <877cvvfnp6.fsf@gmx.de> X-Priority: 3 Importance: Normal 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:257348 Archived-At: Thanks Michael for digging! This is exactly what I also think happens. However my conclusion is different. I consider the root-cause to be the use= of JUST-THIS-ONE in tramps call to accept-process-output. Please check my = comment to bug=20 https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D12145 Applying a workaround (adding extra code to surpress ControlMaster with a n= ewly introduced hook) would increase the complexity and thus brittleness. I= believe the right thing to do is remove JUST-THIS-ONE in Tramp and fix fin= d-name-dired and any other place that's broken. As a practical roadmap you could add an option to Tramp to disable JUST-THI= S-ONE and recommend its use. Later the options default could be toggled. Ev= entually the option can go away. Eglot could emit a warning if it sees the above tramp option not being used= . (... could lead to Emacs hanging. Are you sure to continue (y/n)?) > Michael Albinus hat am 05.03.2023 13:21 EET gesc= hrieben: >=20 > =20 > Jo=C3=A3o T=C3=A1vora writes: >=20 > Hi Jo=C3=A3o, >=20 > >> Yes. But Tramp calls accept-process-output only, if it has send a > >> command to the remote shell, and it expects something to be returned. = At > >> least the shell prompt. > > > > Yes. Tramp is doing the right thing. It really expects a response to > > come. And more often than not, it does. But sometimes it doesn't, and > > that's when we hang. >=20 > After digging further, I believe I understand now why it hangs. We have > the following scenario: >=20 > - Both Eglot and Tramp use the same ssh connection with enabled ControlMa= ster. >=20 > - Eglot gets JSON output from the remote LSP server. In > jsonrpc--process-filter, this output is handled. It includes a call to > file-truename, which triggers Tramp to send a request in its own > process to the remote side. >=20 > - The remote side returns the answer for Tramp (shell output). However, > the ssh socket is still full of the jsonrpc process output, which > waits to be handled. >=20 > - So the socket is blocked. The jsonrpc output cannot be read, because > jsonrpc--process-filter waits for the result of file-truename. And the > Tramp process output cannot be handled, because it is stuck in the > socket after the jsonrpc output. >=20 > The proper solution is indeed to have two connections, and to refuse use > of ControlMaster. >=20 > Surprisingly, this is not new to Tramp :-) But I've simply forgotten the > case ... >=20 > See tramp-integration.el. There is a comment for bug#45518, a similar > blocking in compile.el. And the solution is indeed to disable ssh > ControlMaster. Tramp hooks into compilation-mode-hook, and sets > tramp-use-ssh-controlmaster-options buffer-local to nil. >=20 > I'd like to apply the same solution for eglot.el. Unfortunately, there's > no hook Tramp could use. I've played with eglot-server-initialized-hook, > but this is applied too late. >=20 > So would you mind to add a hook to Eglot, which runs before calling > make-process, but in the proper process buffer? When you've added it, > I'll let Tramp hook into, and you don't need any longer the Tramp > specific code in eglot.el. >=20 > In parallel, I'll extend tramp-use-ssh-controlmaster-options to accept a > further value 'suppress', which overrides possible settings in ~/.ssh/con= fig. >=20 > > Jo=C3=A3o >=20 > Best regards, Michael.