From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Pettersson Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <86wmoo4oel.fsf@gnu.org> 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="20504"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70522@debbugs.gnu.org, app-emacs-dev@janestreet.com, Aaron Zeng , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 23 18:59:14 2024 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 1rzJU9-00057r-TA for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Apr 2024 18:59:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzJTt-0007K2-2w; Tue, 23 Apr 2024 12:58:57 -0400 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 1rzJTr-0007Jr-Uf for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2024 12:58:55 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzJTr-0005fX-Mb for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2024 12:58:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rzJU7-0006Zk-Cl for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2024 12:59:11 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Pettersson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Apr 2024 16:59:10 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70522 X-GNU-PR-Package: emacs Original-Received: via spool by 70522-submit@debbugs.gnu.org id=B70522.171389152224968 (code B ref 70522); Tue, 23 Apr 2024 16:59:10 +0000 Original-Received: (at 70522) by debbugs.gnu.org; 23 Apr 2024 16:58:42 +0000 Original-Received: from localhost ([127.0.0.1]:53282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzJTb-0006UU-UT for submit@debbugs.gnu.org; Tue, 23 Apr 2024 12:58:42 -0400 Original-Received: from mail-lj1-f178.google.com ([209.85.208.178]:57694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzJTU-0006SP-68 for 70522@debbugs.gnu.org; Tue, 23 Apr 2024 12:58:37 -0400 Original-Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2dd7e56009cso31355051fa.3 for <70522@debbugs.gnu.org>; Tue, 23 Apr 2024 09:58:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713891489; x=1714496289; h=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=sisEilpjxAEL7T3lSioCQ4rmlBZTj3zJqypufIxtYj8=; b=GKp50P3c5AteryBWkHMRyXw5bHuyn+ulXKOGacX8T6igx7ZHSAnX6C//gKelUcxuxg y/DUCDNYvWHi+3JDvIzGs69QvuMnmHuwcjSKuT+R+X/5PhCAINJJhCdCmy+eMmcfM3Q+ XEnDL4jbvKHgMYdUP6zRvQTwkeyUGAKSpfBn/tSvBSdkHh/ZipqVShE7hwR1jCyPYLgJ 5veWSHM/js7kDthmlMbmL50/rj/2V98PgLClUvcvadZGYMUmCO0diRVSenkJIemq0WY/ N34PvQcwdXXAZjcFAzqvzd33idI1dSK7EnccyPdwb3NuBSM/Bj7J2SvHsdqAqenneM44 dAyQ== X-Forwarded-Encrypted: i=1; AJvYcCWMmjHkOKBP/5ByApvimGZfgtZ/qfK6kcslko6U0cSfXbbvuonvLLYIioWF5xunbDl3MMJzKE4+dh5P1wn1V4EEoaEBxxk= X-Gm-Message-State: AOJu0YwVecmEEs0PseGvv4A0WcI6/Af307BsGbF0g8DKcWmaxZWyoY+k 2Y7cmh8gyLJfCTesXFadxHopIuVjH2ne40DhO0JG2cocGM2pdkhR X-Google-Smtp-Source: AGHT+IEkw6daTS8ZZZ8XPh+5UtEwcQhOzIf60tUUeE9ViKDmuRQWyMkmYZuJfCySjRDiql1Qgq8o6g== X-Received: by 2002:a2e:9316:0:b0:2dc:d26e:5e8 with SMTP id e22-20020a2e9316000000b002dcd26e05e8mr9696328ljh.34.1713891488856; Tue, 23 Apr 2024 09:58:08 -0700 (PDT) Original-Received: from Daniels-Air (c-72cde455.027-357-6d6c6d4.bbcust.telenor.se. [85.228.205.114]) by smtp.gmail.com with ESMTPSA id t7-20020a2e9c47000000b002d68abf446bsm1756194ljj.139.2024.04.23.09.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 09:58:08 -0700 (PDT) In-Reply-To: <86wmoo4oel.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 23 Apr 2024 08:51:46 +0300") 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:283887 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=doc_changes.diff Content-Description: documentation changes 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))) --=-=-= Content-Type: text/plain / Daniel --=-=-=--