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#45518: Ctrl-G Fails to Interrupt Hung Tramp Remote-Compile in Emacs 27.1 Date: Thu, 11 Feb 2021 16:22:26 +0100 Message-ID: <87sg62bpe5.fsf@gmx.de> References: <87wnvgaq2y.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26531"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 45518@debbugs.gnu.org To: Duncan Greatwood Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 11 16:23:16 2021 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 1lADoK-0006nw-DA for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Feb 2021 16:23:16 +0100 Original-Received: from localhost ([::1]:34242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lADoJ-0004V2-CL for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Feb 2021 10:23:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lADo6-0004UO-E8 for bug-gnu-emacs@gnu.org; Thu, 11 Feb 2021 10:23:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lADo5-0004ED-TE for bug-gnu-emacs@gnu.org; Thu, 11 Feb 2021 10:23:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lADo5-0004Vs-OS for bug-gnu-emacs@gnu.org; Thu, 11 Feb 2021 10:23: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: Thu, 11 Feb 2021 15:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45518 X-GNU-PR-Package: emacs Original-Received: via spool by 45518-submit@debbugs.gnu.org id=B45518.161305695817315 (code B ref 45518); Thu, 11 Feb 2021 15:23:01 +0000 Original-Received: (at 45518) by debbugs.gnu.org; 11 Feb 2021 15:22:38 +0000 Original-Received: from localhost ([127.0.0.1]:59113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lADni-0004VD-50 for submit@debbugs.gnu.org; Thu, 11 Feb 2021 10:22:38 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]:55391) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lADne-0004Ux-30 for 45518@debbugs.gnu.org; Thu, 11 Feb 2021 10:22:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1613056947; bh=oibAY4G+04nbRx0OGD2ai3v3O4nXiDzR9XC4/ubV384=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=jvCsD0Xy+RoJSeh6mGcIw/0SC6YKtwzLlWQ1uMv6iyttdSxGYlvhEsEyEfnugKAoR yL2uw3zDH7xuHQyblC7AF2g+j9eaw/YnaxYfUc9LzwauA2pWLKlqcV5PCCergvfFAr FM+cOCvKDsB3KOQzLEnNxC/EXycZI69LdxVxWqsM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([212.86.51.67]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N0X8u-1m4PLj1TIC-00wUGK; Thu, 11 Feb 2021 16:22:27 +0100 In-Reply-To: <87wnvgaq2y.fsf@gmx.de> (Michael Albinus's message of "Wed, 10 Feb 2021 16:40:37 +0100") X-Provags-ID: V03:K1:p8aGRt80VM9FHaaEdA4nCjz0o8cwBfmxQEFGGUchVtXrEWHCNAm qQVYKPO2vgjiOAVPWyiVMULBrvjAnk/hsG7CKuX79dAPvKowf90WCzwleLwKZtq9nhWYyv6 utppkYYUElqxsmL54AflBlUTgH0nV+zhoso8RPVz6555wcp/PrdKakb5OBuomNjMlvMN7+w ea/Y905H8FJQderSlAcDA== X-UI-Out-Filterresults: notjunk:1;V03:K0:o4jW6N3mbAM=:fsCe9gKtDC8Y1vTBhJ+KtX 5vNq8d4MEH2nqkmarG77JZfYMf4rgSoTInIlTj4vNcpSRntmdC/gEXekxdQajfGzMgcQOfxpN 5Dtq+cLx7uU3PbXSst4ksq2QdsoL38CDXW2QhKeeNqd6fSOJo7mAIZt7cL2Ekkg+hjMLQHpBU iyqaIoueDhoTVOLIhtkMtylUWBN01zr3zJB8PaVnOpo8QerWjS9LzRPHX04lbSinCF8x7xPRy oc/b3/ganqscszMRdUMUG2WfNMBY8bivM8Av0JdFZm/0u+UqbEvEHcqcirPp5T6Y61WmdF/ed ZOH3g8nr07wMT5ei9TmaJVJ/ZGR149/MHMP7gEh8h+aP9KJlbYpILiFjmyawkpcviHjAG/UDF uwnlUMfiLYxNhQ71UiJUZbOGHZEaoCibASajlTqcctVUsrXgH2Me2X1E4zHfYS4mwza3MnOlb OF0WCUyRPUHybiwQN1gw69oT2yiPy+/Vg+WKC3hckpY6Jw3iYcUMrUhACi0nPPNcbWnrvSXIr MTyTgb1nkdk1LBoOJ8EidTkXJMnfPFauqL4sq3TEDoEHudn0BAsAgmIUdFRL85HjVhhAV+DPh zNn/oTLvQfTrmbhSLSMyvA1tdzKvp5eIpM4A2vjx+CMBM+K9o8nbqikO7VJ2Alr7KdmVXWlx0 pJZLl0Eg7r/0wiIi1/Oneqs4fsGEzBNPF9i8vYeHCxtRUSKoUnujVsIZY17K1+r+esepg5R14 DrFxFanJ6fPCi2yjdVpwR3NhMt/Rj9LAoKyT0RNZP+Lgxys2uAIOtNUBYCmTAdaQOXtOU0/N 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" Xref: news.gmane.io gmane.emacs.bugs:199819 Archived-At: --=-=-= Content-Type: text/plain Michael Albinus writes: Hi Duncan, >> There is still one tramp hanging issue I saw in my testing. This is a >> much less serious issue (pressing ctrl-G once "unhangs"), but thought >> I'd mention it here. LMK if you'd prefer a separate bug report and >> I'll create one. > > Just an update. I've played with this for a while. I could reproduce, > and I also know where it hangs. It is accept-process-output of the Tramp > process which tries to view the file you have clicked on, vs > accept-process-output of the compile process. Both don't cooperate > sufficiently, and both hang. > > I have no idea (yet) how to solve. One idea would be to start the > compilation process in another thread, but this will raise other > problems. There is some WIP to make Tramp thread-safe, but this is > stalled ATM. Since I don't know a general solution yet, I have prepared a small patch, which suppresses visting remote files as result of a compilation. Silently. When compilation has finished, everything is back to normal. See the appended patch, whether it makes the situation better for you. >> Thanks again for fixing the main hanging issue! >> Duncan. Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable *** /tmp/ediffuS9ebt 2021-02-11 16:14:54.793873579 +0100 =2D-- /net/ford/albinus/src/tramp/lisp/tramp-integration.el 2021-02-11 16:= 10:01.276681568 +0100 *************** *** 261,266 **** =2D-- 261,294 ---- (delete (info-lookup->mode-cache 'symbol ',mode) (info-lookup->topic-cache 'symbol)))))))) + ;; Compilation processes use `accept-process-output' such a way that + ;; Tramp's parallel `accept-process-output' blocks. See last part of + ;; Bug#45518. So we forbid them to run in parallel. There must be a + ;; better solution, though. + (with-eval-after-load 'compile + (add-hook 'compilation-start-hook + #'tramp-compile-advice-add) + (add-hook 'compilation-finish-functions + #'tramp-compile-advice-remove) + (add-hook 'tramp-integration-unload-hook + (lambda () + (remove-hook 'compilation-start-hook + #'tramp-compile-advice-add) + (remove-hook 'compilation-finish-functions + #'tramp-compile-advice-remove)))) + + (defun tramp-compile-advice-add (proc) + "Don't allow remote file operations while compiling." + (with-current-buffer (process-buffer proc) + (when (file-remote-p default-directory) + (advice-add 'ignore :override 'compile-goto-error)))) + + (defun tramp-compile-advice-remove (buffer _message) + "Reenable remote file operations." + (with-current-buffer buffer + (when (file-remote-p default-directory) + (advice-remove 'ignore 'compile-goto-error)))) + ;;; Default connection-local variables for Tramp: ;; `connection-local-set-profile-variables' and ;; `connection-local-set-profiles' exists since Emacs 26.1. --=-=-=--