From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: John Shahid Newsgroups: gmane.emacs.bugs Subject: bug#35506: Acknowledgement (27.0.50; Emacs hangs while interrupting tramp processes) Date: Tue, 30 Apr 2019 13:28:24 -0400 Message-ID: <87tvefz9l3.fsf@gmail.com> References: <87y33rzalc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="89051"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: mu4e 1.1.0; emacs 27.0.50 To: 35506@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 30 19:29:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLWZB-000N4O-BA for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Apr 2019 19:29:17 +0200 Original-Received: from localhost ([127.0.0.1]:50720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLWZA-0006Zm-6x for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Apr 2019 13:29:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLWYx-0006YI-UK for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 13:29:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLWYw-0004tU-VA for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 13:29:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLWYw-0004tK-PK for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 13:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hLWYw-00077i-Cd for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 13:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Shahid Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Apr 2019 17:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35506 X-GNU-PR-Package: emacs Original-Received: via spool by 35506-submit@debbugs.gnu.org id=B35506.155664531827348 (code B ref 35506); Tue, 30 Apr 2019 17:29:02 +0000 Original-Received: (at 35506) by debbugs.gnu.org; 30 Apr 2019 17:28:38 +0000 Original-Received: from localhost ([127.0.0.1]:42326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hLWYW-000771-P0 for submit@debbugs.gnu.org; Tue, 30 Apr 2019 13:28:38 -0400 Original-Received: from mail-qt1-f178.google.com ([209.85.160.178]:33255) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hLWYU-00076n-VH for 35506@debbugs.gnu.org; Tue, 30 Apr 2019 13:28:35 -0400 Original-Received: by mail-qt1-f178.google.com with SMTP id g7so17203653qtc.0 for <35506@debbugs.gnu.org>; Tue, 30 Apr 2019 10:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:in-reply-to:date:message-id :mime-version; bh=YeLMvDyst1uibHXf2DLztR17QSjoIZ1NnwNvhncxQi0=; b=jW3saIht+UrYrpVfZAzyrWd22KTWiY77sr1YJX6IkYqs+1ILRG15Z7/kPfC1oTL08y ytcAc+RfHLVr2r2cPv/FsKmD0ET3Xw1/mP9OdaMECjY2cUd2kQpfxXIz7QmTwK4wXu+K JrX1+bNUDySYu99wvlKgFeAW4NQrosn9G96DWUxYiJrM1zhV4p+ytzOTYRG6foaBTz5p /JrcmkcuMDelBWa47qYyoahlTLOAdCkTvMOOJ3pU8vlT7jZCuPz3FhCbXwT3Vk51MYrO EBUkONKUg2lnFwEpZilPnYL4I3JUQ5ZKg/d1tRZRcZOJ6C/oU+anZwSkBzWIWYYPOAJB 7RzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject :in-reply-to:date:message-id:mime-version; bh=YeLMvDyst1uibHXf2DLztR17QSjoIZ1NnwNvhncxQi0=; b=RgMhERdR+uc2bYIeB/fNYF8IoCcH7ktz6yYH3KMCs08CHgV+wAyiku/M7SdY23KywJ +8Hi3Ipb5F5LFUektbv2SzKDgXA+AlBga7wWluk/wKIhvgBARkR6Ir3ajtYBzsDSR70q OrqHKT3QbeFMFKY7Ww4K6SPws/rAZb5TIkVpikNR93kfsO/DvrWS+JVvHQNGUtauuYpI ag+3DSuKtM8Yg24pBCJc4tt+n2iXu58pU8BVi90suEkY7PreXsZAMhr83i74qlJyLXNs gyPEuuu6B7OynEU5qb/8Wq06yrQKEESuTf1jQ5oucecR0iXZ4UzvA4/wpDKNSHsbR7Ck QP4g== X-Gm-Message-State: APjAAAVnr8eKWTYA78ntMXh7GGw4qxG52F37fjRJIGkzYSBUoEd9bNrH P2qYPvu3tLXVjY5P5o2DJQclH557 X-Google-Smtp-Source: APXvYqyrYy2xbZxlpoDuUvvi28LL1/5CEVrVqVty8aYeMUaB/DKF+kOOXwzooRTb3w4WBhJS4oMmKw== X-Received: by 2002:a0c:8a9d:: with SMTP id 29mr18152078qvv.7.1556645307973; Tue, 30 Apr 2019 10:28:27 -0700 (PDT) Original-Received: from amun (cpe-104-162-85-46.nyc.res.rr.com. [104.162.85.46]) by smtp.gmail.com with ESMTPSA id 46sm24035206qtz.87.2019.04.30.10.28.25 for <35506@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Apr 2019 10:28:26 -0700 (PDT) In-reply-to: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158519 Archived-At: --=-=-= Content-Type: text/plain Attached are the two patches I mentioned in the bug report. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Kill-the-entire-process-group.patch >From e056e98d4b899b8ae7636a967d0a55125e624fad Mon Sep 17 00:00:00 2001 From: John Shahid Date: Mon, 29 Apr 2019 16:09:32 -0400 Subject: [PATCH] Kill the entire process group Some processes (e.g. terraform) don't handle signals but its subprocess (with the exact same name) does. Killing the parent process doesn't do anything, we have to send the signal to the entire group in order to reach the child. This seems to be what terminals typically do. --- lisp/net/tramp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 2e1a0960d7..427b3c41e3 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4870,7 +4870,7 @@ tramp-interrupt-process (tramp-compat-funcall 'tramp-send-command (process-get proc 'vector) - (format "kill -2 %d" pid)) + (format "kill -2 -%d" pid)) ;; Wait, until the process has disappeared. If it doesn't, ;; fall back to the default implementation. (with-timeout (1 (ignore)) -- 2.21.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Do-not-wait-for-process-output-after-interruption.patch >From cf2d0e2e58a683756878c9c7e4dd2066efe6e807 Mon Sep 17 00:00:00 2001 From: John Shahid Date: Mon, 29 Apr 2019 16:10:47 -0400 Subject: [PATCH] Do not wait for process output after interruption. Some processes such as terraform can have cleanup logic that causes the process to take longer to shut down than normal. This causes eshell to do a busy wait locking up Emacs while waiting for the process to finish. I don't understand why we do that anyway, just let the process finish at its own pace. --- lisp/net/tramp.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 427b3c41e3..27bef45efb 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4873,10 +4873,7 @@ tramp-interrupt-process (format "kill -2 -%d" pid)) ;; Wait, until the process has disappeared. If it doesn't, ;; fall back to the default implementation. - (with-timeout (1 (ignore)) - (while (tramp-accept-process-output proc)) - ;; Report success. - proc))))) + )))) ;; `interrupt-process-functions' exists since Emacs 26.1. (when (boundp 'interrupt-process-functions) -- 2.21.0 --=-=-=--