From unknown Sat Aug 09 01:38:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#59146: Patch: improve eglot-shutdown-all Resent-From: Evgeni Kolev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Nov 2022 11:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59146 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 59146@debbugs.gnu.org Cc: joaotavora@gmail.com X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166799330515503 (code B ref -1); Wed, 09 Nov 2022 11:29:01 +0000 Received: (at submit) by debbugs.gnu.org; 9 Nov 2022 11:28:25 +0000 Received: from localhost ([127.0.0.1]:39164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1osjFp-00041z-FB for submit@debbugs.gnu.org; Wed, 09 Nov 2022 06:28:25 -0500 Received: from lists.gnu.org ([209.51.188.17]:56630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1osjFn-00041r-5Z for submit@debbugs.gnu.org; Wed, 09 Nov 2022 06:28:23 -0500 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 1osjFl-00059K-RY for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2022 06:28:21 -0500 Received: from mail-yb1-xb33.google.com ([2607:f8b0:4864:20::b33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1osjFh-0004Lx-03 for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2022 06:28:21 -0500 Received: by mail-yb1-xb33.google.com with SMTP id j2so20640843ybb.6 for ; Wed, 09 Nov 2022 03:28:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=l+X3WkFvLg+qQs+bM9Q3AVPpaTmNjU6B6+smZdZV5rE=; b=p0EbIm66vD+oBNVIu2oyoUtTGy2slJbXs4tM1gXdmXm8+BFrRZ4d+PFPpNDXQ16dTJ qBaGnEmxsUE149Pu+VQ7ofhvRhlt2zIO1ILipEIht349zuNPY7U+MM2s5+dO07MW+fKp mzexJ85Y5tbEDb4AI84xaS6iWN3Qw09vau5LAzYrPRGm7onokw4+JfmyImv5qZoJAapR wEzamJUqB7wvea0MkrukB8Illo2FghuyfAh1W5C5epUV0CqEEXlTJ/C21SD3CSvGiw9p LjurDRWXQtkHBtzjhh5fKTcO1TtYOpOKsjN+QOUK334cXMm96dwOln0+AfSn1YdkXwJ+ 3l0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=l+X3WkFvLg+qQs+bM9Q3AVPpaTmNjU6B6+smZdZV5rE=; b=nJ2xHVWKJyyOPUOy/bAC6aCsUQDe42Ez48uALJfKTOZwUyJdiya1nSJiMuNA6IEE3P 7p7eaGL4CETtfz20vegPKkY47G/9qP7i7amb08QS1QlcOwhXigcolB4oCEJSDKZQm5Rt gbY0+HZAR0CfgWpHoQk+7hAp1UnWMfCVEnxBcGHj46Pv7LomvFADpNXDO7Kblwq+nBXH G+BVNIkUb31yRcvL/iMpAS2iAwnDHI4jEDgXzRAT86Xz10fzpb8sKCyE48uft5/+TGOh GVf8vKnrjOozIpoxNCHyPeA+HIcxqSsFwvqeREfm525VGMaIJy/pRO2Umq2fhL8txMMy CaIQ== X-Gm-Message-State: ACrzQf2Sv2D8yul+Uf4RuFXDngTGv6gccm16oRQAePCJ5yWqT0MxwL0G jrs3Mp5Fnr6+g9B7XUo43oQ+FgZ0A5jtOSvub3v1xsp7T6UhZ0P6 X-Google-Smtp-Source: AMsMyM4zRGfmlMV0dR/3SROhk9r17mJb24y49dKnTwoNtMbO47kOD3WTqlq3olCUdU3nCE5dVE229+Wz7BUtMpoWd5U= X-Received: by 2002:a5b:a0c:0:b0:6b4:446d:2f9 with SMTP id k12-20020a5b0a0c000000b006b4446d02f9mr61605119ybq.138.1667993295232; Wed, 09 Nov 2022 03:28:15 -0800 (PST) MIME-Version: 1.0 From: Evgeni Kolev Date: Wed, 9 Nov 2022 13:27:49 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::b33; envelope-from=evgenysw@gmail.com; helo=mail-yb1-xb33.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) eglot-shutdown-all has a bug that results in partially stopping servers - when a server shutdown timeouts (1.5s), an error is propagated and eglot-shutdown-all does not try to shutdown the rest of the servers. The patch below (produced with "git show" to include a commit message) modifies eglot-shutdown-all to ignore errors, converting them to messages via "with-demoted-errors". Comparison of old VS new behaviour follows. Steps to reproduce: 1. start 2 different language servers, the servers should be slow to stop (I use gopls in a monorepo, so slow startup time is guaranteed) 2. (optional) if your language server is not slow to stop, change the timeout in eglot-shutdown from 1.5 sec to 0.1 sec to force a timeout 3. run eglot-shutdown-all Before: only one of the 2 servers is stopped - 1st one times out, 2nd one is not asked to stop at all. Messages: ``` [eglot] Asking EGLOT (project1/go-mode) politely to terminate [jsonrpc] Server exited with status 9 down-list: jsonrpc-error: "request id=4 failed:", (jsonrpc-error-message . "Timed out") ``` After: both servers are stopped, the timeout errors are converted to messages by with-demoted-errors. Messages: ``` [eglot] Asking EGLOT (project1/go-mode) politely to terminate [jsonrpc] Server exited with status 9 [eglot] shutdown all: (jsonrpc-error request id=2 failed: (jsonrpc-error-message . Timed out)) [eglot] Asking EGLOT (project2/go-mode) politely to terminate [jsonrpc] Server exited with status 9 [eglot] shutdown all: (jsonrpc-error request id=2 failed: (jsonrpc-error-message . Timed out)) ``` Patch: Author: Evgeni Kolev Date: Wed Nov 9 13:17:01 2022 +0200 Ignore errors when shutting down all LSP servers eglot-shutdown-all has a bug that results in partially stopping servers: when a server shutdown timeouts (1.5s), an error is propagated and eglot-shutdown-all does not try to shutdown the rest of the servers. * eglot.el (eglot-shutdown-all): Ignore errors when shutting down servers, converting errors to messages. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index ce989b5611..5a28c64bb0 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -877,7 +877,8 @@ eglot-shutdown-all PRESERVE-BUFFERS as in `eglot-shutdown', which see." (interactive (list current-prefix-arg)) (cl-loop for ss being the hash-values of eglot--servers-by-project - do (cl-loop for s in ss do (eglot-shutdown s nil nil preserve-buffers)))) + do (with-demoted-errors "[eglot] shutdown all: %s" + (cl-loop for s in ss do (eglot-shutdown s nil nil preserve-buffers))))) (defun eglot--on-shutdown (server) "Called by jsonrpc.el when SERVER is already dead." From unknown Sat Aug 09 01:38:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#59146: Patch: improve eglot-shutdown-all Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Nov 2022 17:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59146 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Evgeni Kolev Cc: 59146@debbugs.gnu.org, 59146-done@debbugs.gnu.org X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, 59146-done@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166810075826346 (code B ref -1); Thu, 10 Nov 2022 17:20:01 +0000 Received: (at submit) by debbugs.gnu.org; 10 Nov 2022 17:19:18 +0000 Received: from localhost ([127.0.0.1]:44269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otBCv-0006qs-Rt for submit@debbugs.gnu.org; Thu, 10 Nov 2022 12:19:18 -0500 Received: from lists.gnu.org ([209.51.188.17]:43098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otBCs-0006qb-52 for submit@debbugs.gnu.org; Thu, 10 Nov 2022 12:19:14 -0500 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 1otBCp-0008J4-Iz for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2022 12:19:13 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otBCm-00057A-1U for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2022 12:19:10 -0500 Received: by mail-wm1-x32d.google.com with SMTP id j5-20020a05600c410500b003cfa9c0ea76so1598792wmi.3 for ; Thu, 10 Nov 2022 09:19:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding: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=HKjtieJudqQ0ojG4ieuLCwFMRQLlXEfyJU1coajf9QY=; b=ecYM03hjYk1PIsd2Bd5OQrxv4mnGdwcZ2eJhdNRMckJIC1QL51ituqstCnvdG0V3yu rczzIWiYorNHSqjy8mSV5ekkcsTixYRvz2C+j+/1pKOEBn1m0Lp7Xcl0atTmW9a+OK82 kmhHsGQsGknYUYrghHtVcqYSjLBLnvSkrqwszpLi7yd/1z7sbMErrUnDsuFSJ+lpLT6I WM8U48ug1EiIQIv8Acl0ErTh7VPl23rFnZW2oyWe5FfWAK8XvRDGk5+oEU6qqaT4JcGl CCQyKJJ4ez9s582Thd1j58r5k0FxOTrtQZejZCGU0v2V1eY8p+Sp0zmDEaX9t/4HZj5Y NCmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=HKjtieJudqQ0ojG4ieuLCwFMRQLlXEfyJU1coajf9QY=; b=g9LxDJHH77XZQG93Lq/2sak8mJoJ2anM6vAawsI3fCLx+8MUz8qhAkwBieC1PtHpS2 YSuIkzrhfvWjkZAxWizKRonPvfhcWx8uMet3EIU1RDmYSmMHLbJmB6pRSTwDexA5tpQp s4XTwWgaY3KGYCRYbS94ezcE0EOTA9oqWfcNa8G0gIhMYIFMZNDNWf4en0riP/ktIErI 2vLyjd/BdUz7dwNQrlB25PycBqIeh6C6Q9NPQH04mfE4qLRv0Yg5pUx5sG/6cRz5R0FH HFctAt5+dLT1ldNFgbxeK2Npq6T2umo13gNkgWfq390Y6qKAItO5VICarj4ppnM3F0Tm mkCg== X-Gm-Message-State: ACrzQf0u3r8r3bslmAwlj2mvCabiAl0Tp23be/aZnPdyU0IZC1dHoZcz Z4kn2PdD+0sGdH0PYn5bvB4= X-Google-Smtp-Source: AMsMyM7A5F56GzicYNOFSQDDLaK5uwAAgNEZYoO3bonoE6udJ6ItXgxV6YV7LZ/nmNKcAZdtiaRCvg== X-Received: by 2002:a05:600c:6026:b0:3cf:78fc:eda2 with SMTP id az38-20020a05600c602600b003cf78fceda2mr1095377wmb.47.1668100746263; Thu, 10 Nov 2022 09:19:06 -0800 (PST) Received: from krug ([87.196.81.1]) by smtp.gmail.com with ESMTPSA id n2-20020a05600c3b8200b003b476cabf1csm158753wms.26.2022.11.10.09.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 09:19:05 -0800 (PST) From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= In-Reply-To: (Evgeni Kolev's message of "Wed, 9 Nov 2022 13:27:49 +0200") References: Date: Thu, 10 Nov 2022 17:20:21 +0000 Message-ID: <87v8nm9162.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=joaotavora@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Thanks, I applied the patch Jo=C3=A3o From unknown Sat Aug 09 01:38:04 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Evgeni Kolev Subject: bug#59146: closed (Re: Patch: improve eglot-shutdown-all) Message-ID: References: <87v8nm9162.fsf@gmail.com> X-Gnu-PR-Message: they-closed 59146 X-Gnu-PR-Package: emacs Reply-To: 59146@debbugs.gnu.org Date: Thu, 10 Nov 2022 17:20:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1668100802-26409-1" This is a multi-part message in MIME format... ------------=_1668100802-26409-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #59146: Patch: improve eglot-shutdown-all which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 59146@debbugs.gnu.org. --=20 59146: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D59146 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1668100802-26409-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 59146-done) by debbugs.gnu.org; 10 Nov 2022 17:19:14 +0000 Received: from localhost ([127.0.0.1]:44267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otBCs-0006qi-L4 for submit@debbugs.gnu.org; Thu, 10 Nov 2022 12:19:14 -0500 Received: from mail-wm1-f45.google.com ([209.85.128.45]:42882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otBCq-0006qO-JV for 59146-done@debbugs.gnu.org; Thu, 10 Nov 2022 12:19:13 -0500 Received: by mail-wm1-f45.google.com with SMTP id p13-20020a05600c468d00b003cf8859ed1bso1603583wmo.1 for <59146-done@debbugs.gnu.org>; Thu, 10 Nov 2022 09:19:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding: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=HKjtieJudqQ0ojG4ieuLCwFMRQLlXEfyJU1coajf9QY=; b=ecYM03hjYk1PIsd2Bd5OQrxv4mnGdwcZ2eJhdNRMckJIC1QL51ituqstCnvdG0V3yu rczzIWiYorNHSqjy8mSV5ekkcsTixYRvz2C+j+/1pKOEBn1m0Lp7Xcl0atTmW9a+OK82 kmhHsGQsGknYUYrghHtVcqYSjLBLnvSkrqwszpLi7yd/1z7sbMErrUnDsuFSJ+lpLT6I WM8U48ug1EiIQIv8Acl0ErTh7VPl23rFnZW2oyWe5FfWAK8XvRDGk5+oEU6qqaT4JcGl CCQyKJJ4ez9s582Thd1j58r5k0FxOTrtQZejZCGU0v2V1eY8p+Sp0zmDEaX9t/4HZj5Y NCmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=HKjtieJudqQ0ojG4ieuLCwFMRQLlXEfyJU1coajf9QY=; b=Shx5/MiQP6VloN92/KFxS1mcAsDqWMGLVjZ4roVWFMwNspp28eS6TZQ1KPY9LQ4W4p v6/HDmeFLRpdXtDMiib5JkVOfIR9QaZ6FbpqE3fxvyZjEaOVfJlu7FR3DS5EkjlDoarp x5dwK5blTYMHPQQpvA+U+NkxyVPnypayxtWp+3wWwA46Zkfc5g5cu9kUBjQGHWyobkD2 9ZKwSuCm67PMAD2duae21dJxC3vDlrYwh46fL1UMI87xrqVt966y07V61xVwespBCFk8 q29+qNlGitO+gP32KpWLsElsitOqUhHnMRXrRUwqVRnlNH9b/c0H5/vsRYeukvbKyYrQ V2Fw== X-Gm-Message-State: ACrzQf2avKlLbTcriduESic4ZueEeYvu1PaUTGuCaGYUXuR6T42qFrfN uQsyvqHjvwhlYxCmlqZzmFlU1wLdllw= X-Google-Smtp-Source: AMsMyM7A5F56GzicYNOFSQDDLaK5uwAAgNEZYoO3bonoE6udJ6ItXgxV6YV7LZ/nmNKcAZdtiaRCvg== X-Received: by 2002:a05:600c:6026:b0:3cf:78fc:eda2 with SMTP id az38-20020a05600c602600b003cf78fceda2mr1095377wmb.47.1668100746263; Thu, 10 Nov 2022 09:19:06 -0800 (PST) Received: from krug ([87.196.81.1]) by smtp.gmail.com with ESMTPSA id n2-20020a05600c3b8200b003b476cabf1csm158753wms.26.2022.11.10.09.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 09:19:05 -0800 (PST) From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= To: Evgeni Kolev Subject: Re: Patch: improve eglot-shutdown-all In-Reply-To: (Evgeni Kolev's message of "Wed, 9 Nov 2022 13:27:49 +0200") References: Date: Thu, 10 Nov 2022 17:20:21 +0000 Message-ID: <87v8nm9162.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59146-done Cc: bug-gnu-emacs@gnu.org, 59146-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Thanks, I applied the patch Jo=C3=A3o ------------=_1668100802-26409-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 9 Nov 2022 11:28:25 +0000 Received: from localhost ([127.0.0.1]:39164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1osjFp-00041z-FB for submit@debbugs.gnu.org; Wed, 09 Nov 2022 06:28:25 -0500 Received: from lists.gnu.org ([209.51.188.17]:56630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1osjFn-00041r-5Z for submit@debbugs.gnu.org; Wed, 09 Nov 2022 06:28:23 -0500 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 1osjFl-00059K-RY for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2022 06:28:21 -0500 Received: from mail-yb1-xb33.google.com ([2607:f8b0:4864:20::b33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1osjFh-0004Lx-03 for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2022 06:28:21 -0500 Received: by mail-yb1-xb33.google.com with SMTP id j2so20640843ybb.6 for ; Wed, 09 Nov 2022 03:28:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=l+X3WkFvLg+qQs+bM9Q3AVPpaTmNjU6B6+smZdZV5rE=; b=p0EbIm66vD+oBNVIu2oyoUtTGy2slJbXs4tM1gXdmXm8+BFrRZ4d+PFPpNDXQ16dTJ qBaGnEmxsUE149Pu+VQ7ofhvRhlt2zIO1ILipEIht349zuNPY7U+MM2s5+dO07MW+fKp mzexJ85Y5tbEDb4AI84xaS6iWN3Qw09vau5LAzYrPRGm7onokw4+JfmyImv5qZoJAapR wEzamJUqB7wvea0MkrukB8Illo2FghuyfAh1W5C5epUV0CqEEXlTJ/C21SD3CSvGiw9p LjurDRWXQtkHBtzjhh5fKTcO1TtYOpOKsjN+QOUK334cXMm96dwOln0+AfSn1YdkXwJ+ 3l0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=l+X3WkFvLg+qQs+bM9Q3AVPpaTmNjU6B6+smZdZV5rE=; b=nJ2xHVWKJyyOPUOy/bAC6aCsUQDe42Ez48uALJfKTOZwUyJdiya1nSJiMuNA6IEE3P 7p7eaGL4CETtfz20vegPKkY47G/9qP7i7amb08QS1QlcOwhXigcolB4oCEJSDKZQm5Rt gbY0+HZAR0CfgWpHoQk+7hAp1UnWMfCVEnxBcGHj46Pv7LomvFADpNXDO7Kblwq+nBXH G+BVNIkUb31yRcvL/iMpAS2iAwnDHI4jEDgXzRAT86Xz10fzpb8sKCyE48uft5/+TGOh GVf8vKnrjOozIpoxNCHyPeA+HIcxqSsFwvqeREfm525VGMaIJy/pRO2Umq2fhL8txMMy CaIQ== X-Gm-Message-State: ACrzQf2Sv2D8yul+Uf4RuFXDngTGv6gccm16oRQAePCJ5yWqT0MxwL0G jrs3Mp5Fnr6+g9B7XUo43oQ+FgZ0A5jtOSvub3v1xsp7T6UhZ0P6 X-Google-Smtp-Source: AMsMyM4zRGfmlMV0dR/3SROhk9r17mJb24y49dKnTwoNtMbO47kOD3WTqlq3olCUdU3nCE5dVE229+Wz7BUtMpoWd5U= X-Received: by 2002:a5b:a0c:0:b0:6b4:446d:2f9 with SMTP id k12-20020a5b0a0c000000b006b4446d02f9mr61605119ybq.138.1667993295232; Wed, 09 Nov 2022 03:28:15 -0800 (PST) MIME-Version: 1.0 From: Evgeni Kolev Date: Wed, 9 Nov 2022 13:27:49 +0200 Message-ID: Subject: Patch: improve eglot-shutdown-all To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::b33; envelope-from=evgenysw@gmail.com; helo=mail-yb1-xb33.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: joaotavora@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) eglot-shutdown-all has a bug that results in partially stopping servers - when a server shutdown timeouts (1.5s), an error is propagated and eglot-shutdown-all does not try to shutdown the rest of the servers. The patch below (produced with "git show" to include a commit message) modifies eglot-shutdown-all to ignore errors, converting them to messages via "with-demoted-errors". Comparison of old VS new behaviour follows. Steps to reproduce: 1. start 2 different language servers, the servers should be slow to stop (I use gopls in a monorepo, so slow startup time is guaranteed) 2. (optional) if your language server is not slow to stop, change the timeout in eglot-shutdown from 1.5 sec to 0.1 sec to force a timeout 3. run eglot-shutdown-all Before: only one of the 2 servers is stopped - 1st one times out, 2nd one is not asked to stop at all. Messages: ``` [eglot] Asking EGLOT (project1/go-mode) politely to terminate [jsonrpc] Server exited with status 9 down-list: jsonrpc-error: "request id=4 failed:", (jsonrpc-error-message . "Timed out") ``` After: both servers are stopped, the timeout errors are converted to messages by with-demoted-errors. Messages: ``` [eglot] Asking EGLOT (project1/go-mode) politely to terminate [jsonrpc] Server exited with status 9 [eglot] shutdown all: (jsonrpc-error request id=2 failed: (jsonrpc-error-message . Timed out)) [eglot] Asking EGLOT (project2/go-mode) politely to terminate [jsonrpc] Server exited with status 9 [eglot] shutdown all: (jsonrpc-error request id=2 failed: (jsonrpc-error-message . Timed out)) ``` Patch: Author: Evgeni Kolev Date: Wed Nov 9 13:17:01 2022 +0200 Ignore errors when shutting down all LSP servers eglot-shutdown-all has a bug that results in partially stopping servers: when a server shutdown timeouts (1.5s), an error is propagated and eglot-shutdown-all does not try to shutdown the rest of the servers. * eglot.el (eglot-shutdown-all): Ignore errors when shutting down servers, converting errors to messages. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index ce989b5611..5a28c64bb0 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -877,7 +877,8 @@ eglot-shutdown-all PRESERVE-BUFFERS as in `eglot-shutdown', which see." (interactive (list current-prefix-arg)) (cl-loop for ss being the hash-values of eglot--servers-by-project - do (cl-loop for s in ss do (eglot-shutdown s nil nil preserve-buffers)))) + do (with-demoted-errors "[eglot] shutdown all: %s" + (cl-loop for s in ss do (eglot-shutdown s nil nil preserve-buffers))))) (defun eglot--on-shutdown (server) "Called by jsonrpc.el when SERVER is already dead." ------------=_1668100802-26409-1--