unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Pettersson <daniel@dpettersson.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 70522@debbugs.gnu.org, app-emacs-dev@janestreet.com,
	"Aaron Zeng" <azeng@janestreet.com>,
	"João Távora" <joaotavora@gmail.com>
Subject: bug#70522: 29.2.50; eglot-shutdown sends SIGKILL before LSP server can exit gracefully
Date: Tue, 23 Apr 2024 18:58:06 +0200	[thread overview]
Message-ID: <m27cgo2ezl.fsf@dpettersson.net> (raw)
In-Reply-To: <86wmoo4oel.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 23 Apr 2024 08:51:46 +0300")

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> Daniel, could you please look into this issue?

Change makes sense, the only "risk" is that jsonrpc users populate the
*Warnings* buffer with an warning that they should take action upon and
solve, so I think this is an no brainer.

Nice job!

I have done some adhock testing of eglot and dape. Was not able to
produce the warning, which means that eglot and dape are using the
function as intended (at least when interacting with the servers I
tested with).

When the function is touched I would like to do some small additions to
the documentation of the function, would be nice if the docstring
mention the undocumented behavior and an small comment to make it a bit
easier to follow along. 


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: documentation changes --]
[-- Type: text/x-patch, Size: 1024 bytes --]

diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 5037d8c5b2b..111e58cefe2 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -591,15 +591,18 @@ jsonrpc-running-p
 (cl-defmethod jsonrpc-shutdown ((conn jsonrpc-process-connection)
                                 &optional cleanup)
   "Wait for JSONRPC connection CONN to shutdown.
-With optional CLEANUP, kill any associated buffers."
+With optional CLEANUP, kill any associated buffers.
+If CONN is not shutdown within an reasonable amount of time, warn
+and delete process."
   (unwind-protect
       (cl-loop
        with proc = (jsonrpc--process conn) for i from 0
        while (not (process-get proc 'jsonrpc-sentinel-cleanup-started))
        unless (zerop i) do
        (jsonrpc--warn "Sentinel for %s still hasn't run, deleting it!" proc)
-       do
        (delete-process proc)
+       do
+       ;; Let sentinel have a chance to run
        (accept-process-output nil 0.1))
     (when cleanup
       (kill-buffer (process-buffer (jsonrpc--process conn)))

[-- Attachment #3: Type: text/plain, Size: 10 bytes --]


/ Daniel

  reply	other threads:[~2024-04-23 16:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 21:39 bug#70522: 29.2.50; eglot-shutdown sends SIGKILL before LSP server can exit gracefully Aaron Zeng
2024-04-23  5:51 ` Eli Zaretskii
2024-04-23 16:58   ` Daniel Pettersson [this message]
2024-04-27  9:20     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m27cgo2ezl.fsf@dpettersson.net \
    --to=daniel@dpettersson.net \
    --cc=70522@debbugs.gnu.org \
    --cc=app-emacs-dev@janestreet.com \
    --cc=azeng@janestreet.com \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).