From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70724: 29.2.50; eglot-reconnect errors when the project is deleted Date: Thu, 21 Nov 2024 15:51:36 -0500 Message-ID: References: <8634qffrly.fsf@gnu.org> Reply-To: Spencer Baugh Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19062"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Dmitry Gutov , Eli Zaretskii , app-emacs-dev@janestreet.com, 70724@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 21 21:52:34 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 1tEEAD-0004no-HP for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Nov 2024 21:52:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tEE9t-0000Mq-HM; Thu, 21 Nov 2024 15:52:13 -0500 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 1tEE9k-0000MZ-2N for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 15:52:04 -0500 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 1tEE9j-0001az-Pq for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 15:52:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=UVOtA3b8tHdHHhJA/Ep2vuH9AYaxfadkzke00X6GRck=; b=ggHAp5KBrniwFYaSdqIMVSEOy8+W0gXT59Z+zMHaa1Zm+QRetqCJS6Kw13r+gqUIPzyoyARtznD8U2iPQeH6NpOhbRm53Yz8cxuUTFD7Mw5hgHPGU4KkAqtlG3q1bTGAwICCjL1edRNa4uVlvnHPR37e4Se0R+q1tCf6szfOqvYSknfQhEB/eA7XXJ92HVZQGmnbSue0P/Oq7qgtUBw0TVJPdMi958nzDtMvgcbKXa7KEY4Z0ULWPnWHeXLlRML9PaZQ35BWO3cVx94DN9/Gsmx3aQnNRgTwl3EYU8Fm2x7zaMKNHdoc9WHcI7L3RiEmvnC2dbKKzlJsy95e/lNGcw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tEE9i-0006aS-JO for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 15:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Nov 2024 20:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70724 X-GNU-PR-Package: emacs Original-Received: via spool by 70724-submit@debbugs.gnu.org id=B70724.173222230425295 (code B ref 70724); Thu, 21 Nov 2024 20:52:02 +0000 Original-Received: (at 70724) by debbugs.gnu.org; 21 Nov 2024 20:51:44 +0000 Original-Received: from localhost ([127.0.0.1]:51935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEE9P-0006Zu-KE for submit@debbugs.gnu.org; Thu, 21 Nov 2024 15:51:44 -0500 Original-Received: from mxout1.mail.janestreet.com ([38.105.200.78]:41191) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEE9N-0006Zi-O2 for 70724@debbugs.gnu.org; Thu, 21 Nov 2024 15:51:42 -0500 In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Thu, 21 Nov 2024 20:14:24 +0000") DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1732222296; bh=UVOtA3b8tHdHHhJA/Ep2vuH9AYaxfadkzke00X6GRck=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=XObfqAbJAid1Z3D3LtJSVbTwndMvLqMxeWAiGX5srMq7x8RmIRqatAAo5WT/YARDF EPe8UMoAqAvPXsiDynSHFFJNW0z+7y0aYqZhgia7gjIF/fDchMz/nvEBtZyzaqX1mi AaGLtn7cUDXRX2V3lWSD062niGEJXu7Kol85jwv5ubpfETlXzivMWtEJCssOLJf1uH yrZWRZGiFVTWHtOpZFpZ2jz3Fcask1forVTCTwo6F5DIPIw2Kfyd5On3SvgUh3F+6t 8AMQaghcWejf7jKkFL1lv+2v+DswOBzaDKEwJa3sjn+b6ZR7as7DZVOIeAb0bs0agI 1lEBlcH6/IxJQ== 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:295755 Archived-At: Jo=C3=A3o T=C3=A1vora writes: > Explain your scenario, please. And note that if you take the rug from > underneath Eglot it will error, period. That's by design. I'm not > willing to contort the code to do anything more than provide a > more or less understandable error message for such (relatively rare) > rug pulling. IOW sentinels erroring is part of Emacs life and not a > bug in itself, it's the error message that I'm willing to help ensure is > clear. I use (the equivalent of) git worktrees to have one repo checkout per branch that I'm working on. As I finish work on a branch, I delete the worktree with a shell command outside of Emacs. Thus I hit this error several times a day, depending on how productive I am. (The same workflow is used by ~everyone at my employer, and before we can use Eglot widely, it would be ideal to get rid of this frequent error) > Please provide a backtrace and say if it's obtained with the very > same recipe in the beginning of the bug report. > Sure, here's the backtrace with the patch in your last email. It is obtained with the very same recipe in the beginning of the bug report: I opened an (OCaml) file, did M-x eglot (starting ocaml-lsp), deleted the directory, and it proceeded as I said in the beginning of the bug report. Debugger entered--Lisp error: (error "[eglot] Project at `/usr/local/home/s= baugh/workspaces/fe-880764/+share+/' is gone!") signal(error ("[eglot] Project at `/usr/local/home/sbaugh/workspaces/fe-8= 80764/+share+/' is gone!")) error("[eglot] %s" "Project at `/usr/local/home/sbaugh/workspaces/fe-8807= 64/+share+/' is gone!") eglot--error("Project at `%s' is gone!" "/usr/local/home/sbaugh/workspace= s/fe-880764/+share+/") (if (file-exists-p default-directory) (project-name project) (eglot--erro= r "Project at `%s' is gone!" default-directory)) (let* ((default-directory (project-root project)) (nickname (if (file-exi= sts-p default-directory) (project-name project) (eglot--error "Project at `= %s' is gone!" default-directory))) (readable-name (format "EGLOT (%s/%s)" n= ickname managed-modes)) server-info (contact (if (functionp contact) (funca= ll contact) contact)) (initargs (cond ((keywordp (car contact)) contact) ((= integerp (car (cdr contact))) (setq server-info (list (format "%s:%s" ... .= ..))) (list ':process #'(lambda nil ...))) ((and (stringp (car contact)) (c= l-find-if #'... contact)) (setq server-info (list "")) (l= ist ':process (jsonrpc-autoport-bootstrap readable-name contact :connect-ar= gs '...))) ((stringp (car contact)) (let* ((probe ...) (more-initargs ...) = (contact ...)) (cons ':process (cons ... more-initargs)))))) (spread #'(lam= bda (fn) #'(lambda (server method params) (let ... ...)))) (server (apply #= 'make-instance class :name readable-name :events-buffer-config eglot-events= -buffer-config :notification-dispatcher (funcall spread #'eglot-handle-noti= fication) :request-dispatcher (funcall spread #'eglot-handle-request) :on-s= hutdown #'eglot--on-shutdown initargs)) (canceled nil) (tag (make-symbol "c= onnected-catch-tag"))) (if server-info (progn (jsonrpc--debug server "Runni= ng language server: %s" (string-join server-info " ")))) (let* ((v server))= (\(setf\ eglot--saved-initargs\) initargs v)) (let* ((v server)) (\(setf\ = eglot--project\) project v)) (let* ((v server)) (\(setf\ eglot--project-nic= kname\) nickname v)) (let* ((v server)) (\(setf\ eglot--languages\) (let* (= (--cl-var-- managed-modes) (m nil) (--cl-var-- language-ids) (l nil) (--cl-= var-- nil)) (while (and (consp --cl-var--) (progn (setq m ...) (consp --cl-= var--))) (setq l (car --cl-var--)) (setq --cl-var-- (cons (cons m l) --cl-v= ar--)) (setq --cl-var-- (cdr --cl-var--)) (setq --cl-var-- (cdr --cl-var--)= )) (nreverse --cl-var--)) v)) (run-hook-with-args 'eglot-server-initialized= -hook server) (unwind-protect (condition-case _quit (let ((retval (catch ta= g (jsonrpc-async-request server :initialize ... :success-fn ... :timeout eg= lot-connect-timeout :error-fn ... :timeout-fn ...) (cond ... ...)))) (cond = ((consp retval) (let* (...) (if ... ... ...))) ((null retval) (let nil (egl= ot--message "Waiting in background for server `%s'" ...) nil)) (t (let nil = server)))) (quit (jsonrpc-shutdown server) (setq canceled 'quit))) (setq ta= g nil))) eglot--connect((tuareg-mode) #s(jane-fe-project :workspace "/usr/local/ho= me/sbaugh/workspaces/fe-880764/+share+/" :vc (vc Hg "/usr/local/home/sbaugh= /workspaces/fe-880764/+share+/")) eglot-lsp-server (:process (closure ((con= tact "dispatch_ocaml_lsp.exe" "open! Core" "dev") (server-info "dispatch_oc= aml_lsp.exe" "open! Core" "dev") (readable-name . "EGLOT (dune-add-disable-= file-watcher-rpc/(tuareg-mode))") tramp-ssh-controlmaster-options tramp-use= -ssh-controlmaster-options) nil (let ((default-directory default-directory)= (tramp-use-ssh-controlmaster-options 'suppress) (tramp-ssh-controlmaster-o= ptions "-o ControlMaster=3Dno -o ControlPath=3Dnone")) (make-process :name = readable-name :command (setq server-info (eglot--cmd contact)) :connection-= type 'pipe :coding 'utf-8-emacs-unix :noquery t :stderr (get-buffer-create = (format "*%s stderr*" readable-name)) :file-handler t)))) ("tuareg")) eglot-reconnect(#) (cond ((eglot--shutdown-requested server) t) ((not (eglot--inhibit-autore= connect server)) (eglot--warn "Reconnecting after unexpected server exit.")= (eglot-reconnect server)) ((timerp (eglot--inhibit-autoreconnect server)) = (eglot--warn "Not auto-reconnecting, last one didn't last long."))) eglot--on-shutdown(#) funcall(eglot--on-shutdown #) (unwind-protect (mapc #'(lambda (jsonrpc-lambda-elem168) (apply #'(lambda= (_id _method _success-fn error-fn _timer) (funcall error-fn '(:code -1 :me= ssage "Server died"))) jsonrpc-lambda-elem168)) (jsonrpc--continuations con= nection)) (jsonrpc--message "Server exited with status %s" (process-exit-st= atus proc)) (delete-process proc) (let* ((p (and t (slot-value connection '= -autoport-inferior)))) (if p (delete-process p) nil)) (funcall (jsonrpc--on= -shutdown connection) connection)) (progn (save-current-buffer (set-buffer (jsonrpc-events-buffer connection= )) (let ((inhibit-read-only t)) (insert "\n----------b---y---e---b---y---e-= ---------\n"))) (mapc #'(lambda (jsonrpc-lambda-elem167) (apply #'(lambda (= _id _method _success-fn _error-fn timer) (if timer (progn (cancel-timer tim= er)))) jsonrpc-lambda-elem167)) (jsonrpc--continuations connection)) (mapha= sh #'(lambda (_ triplet) (progn (ignore (consp triplet)) (let* ((x919 (cdr-= safe triplet))) (progn (ignore (consp x919)) (let* ((x920 (car-safe x919)) = (x921 (cdr-safe x919))) (progn (ignore (consp x921)) (let* ((x923 (cdr-safe= x921))) (progn (ignore (null x923)) (let ((timer x920)) (if timer (progn (= cancel-timer timer)))))))))))) (jsonrpc--deferred-actions connection)) (pro= cess-put proc 'jsonrpc-sentinel-cleanup-started t) (unwind-protect (mapc #'= (lambda (jsonrpc-lambda-elem168) (apply #'(lambda (_id _method _success-fn = error-fn _timer) (funcall error-fn '(:code -1 :message "Server died"))) jso= nrpc-lambda-elem168)) (jsonrpc--continuations connection)) (jsonrpc--messag= e "Server exited with status %s" (process-exit-status proc)) (delete-proces= s proc) (let* ((p (and t (slot-value connection '-autoport-inferior)))) (if= p (delete-process p) nil)) (funcall (jsonrpc--on-shutdown connection) conn= ection))) (if (not (process-live-p proc)) (progn (save-current-buffer (set-buffer (= jsonrpc-events-buffer connection)) (let ((inhibit-read-only t)) (insert "\n= ----------b---y---e---b---y---e----------\n"))) (mapc #'(lambda (jsonrpc-la= mbda-elem167) (apply #'(lambda (_id _method _success-fn _error-fn timer) (i= f timer (progn (cancel-timer timer)))) jsonrpc-lambda-elem167)) (jsonrpc--c= ontinuations connection)) (maphash #'(lambda (_ triplet) (progn (ignore (co= nsp triplet)) (let* ((x919 (cdr-safe triplet))) (progn (ignore (consp x919)= ) (let* ((x920 (car-safe x919)) (x921 (cdr-safe x919))) (progn (ignore (con= sp x921)) (let* ((x923 (cdr-safe x921))) (progn (ignore (null x923)) (let (= (timer x920)) (if timer (progn ...))))))))))) (jsonrpc--deferred-actions co= nnection)) (process-put proc 'jsonrpc-sentinel-cleanup-started t) (unwind-p= rotect (mapc #'(lambda (jsonrpc-lambda-elem168) (apply #'(lambda (_id _meth= od _success-fn error-fn _timer) (funcall error-fn '(:code -1 :message "Serv= er died"))) jsonrpc-lambda-elem168)) (jsonrpc--continuations connection)) (= jsonrpc--message "Server exited with status %s" (process-exit-status proc))= (delete-process proc) (let* ((p (and t (slot-value connection '-autoport-i= nferior)))) (if p (delete-process p) nil)) (funcall (jsonrpc--on-shutdown c= onnection) connection)))) (let ((connection (process-get proc 'jsonrpc-connection))) (jsonrpc--debu= g connection "Connection state change: `%s'" change) (if (not (process-live= -p proc)) (progn (save-current-buffer (set-buffer (jsonrpc-events-buffer co= nnection)) (let ((inhibit-read-only t)) (insert "\n----------b---y---e---b-= --y---e----------\n"))) (mapc #'(lambda (jsonrpc-lambda-elem167) (apply #'(= lambda (_id _method _success-fn _error-fn timer) (if timer (progn (cancel-t= imer timer)))) jsonrpc-lambda-elem167)) (jsonrpc--continuations connection)= ) (maphash #'(lambda (_ triplet) (progn (ignore (consp triplet)) (let* ((x9= 19 (cdr-safe triplet))) (progn (ignore (consp x919)) (let* ((x920 (car-safe= x919)) (x921 (cdr-safe x919))) (progn (ignore (consp x921)) (let* ((x923 (= cdr-safe x921))) (progn (ignore (null x923)) (let (...) (if timer ...))))))= )))) (jsonrpc--deferred-actions connection)) (process-put proc 'jsonrpc-sen= tinel-cleanup-started t) (unwind-protect (mapc #'(lambda (jsonrpc-lambda-el= em168) (apply #'(lambda (_id _method _success-fn error-fn _timer) (funcall = error-fn '(:code -1 :message "Server died"))) jsonrpc-lambda-elem168)) (jso= nrpc--continuations connection)) (jsonrpc--message "Server exited with stat= us %s" (process-exit-status proc)) (delete-process proc) (let* ((p (and t (= slot-value connection '-autoport-inferior)))) (if p (delete-process p) nil)= ) (funcall (jsonrpc--on-shutdown connection) connection))))) jsonrpc--process-sentinel(# "exited abnormally with code 1\n")