From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#69809: 30.0.50; flymake: error in process sentinel Date: Thu, 11 Jul 2024 11:45:46 +0200 Message-ID: References: <867chv3mtf.fsf@gnu.org> <87le696o86.fsf@catern.com> Reply-To: Eshel Yaron 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="31636"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: sbaugh@catern.com, Eli Zaretskii , 69809@debbugs.gnu.org, Spencer Baugh To: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 11 11:46:45 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 1sRqNw-000827-UF for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Jul 2024 11:46:45 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sRqNI-00039v-KL; Thu, 11 Jul 2024 05:46:04 -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 1sRqNH-00039R-20 for bug-gnu-emacs@gnu.org; Thu, 11 Jul 2024 05:46:03 -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 1sRqNG-0002Px-QN for bug-gnu-emacs@gnu.org; Thu, 11 Jul 2024 05:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sRqNG-0006io-2A for bug-gnu-emacs@gnu.org; Thu, 11 Jul 2024 05:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jul 2024 09:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69809 X-GNU-PR-Package: emacs Original-Received: via spool by 69809-submit@debbugs.gnu.org id=B69809.172069115125819 (code B ref 69809); Thu, 11 Jul 2024 09:46:02 +0000 Original-Received: (at 69809) by debbugs.gnu.org; 11 Jul 2024 09:45:51 +0000 Original-Received: from localhost ([127.0.0.1]:51087 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sRqN5-0006iM-A3 for submit@debbugs.gnu.org; Thu, 11 Jul 2024 05:45:51 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:50240 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sRqN3-0006iE-16 for 69809@debbugs.gnu.org; Thu, 11 Jul 2024 05:45:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1720691148; bh=aytbCBlM3SvMaZPKMOibgOEjofKczfdWFzVHeL3nYuk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=F1HSeIeZkskoCjgmjtD/w7aIut/peff7L7s8x6et2NWk1r7UWMYhFBQoi9h9c1rvp fodUaSpFIrAca5P7Z8cvSa8UDFHe2/mRwFISn3OQ6wbiKZuJ3zkPPdn1kLMWYlDHMe 8gQp0tYs2KE6Sjq3gu40JF+LUftznrHFGHpeiZweOF+OgSRYYdL4YzxESzD15NCP1w eGsyLq0VFh5MQoIL3p3qVhk/ZLGr7O8ihV5EWzeHOYt4cqFAwjXCD4fnD78s9OUlPN 6MqPz//wl//uE57HdtTj9o9UnacBz7NZSu0mfGbwBcwJJhCswSAaVwz7CEH0iSeU3Z 676bJA7w9eygA== In-Reply-To: ("Gerd =?UTF-8?Q?M=C3=B6llmann?="'s message of "Sat, 23 Mar 2024 15:20:41 +0100") 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:288723 Archived-At: Hi, Gerd M=C3=B6llmann writes: > sbaugh@catern.com writes: > >>> From: Gerd M=C3=B6llmann >>> Date: Fri, 15 Mar 2024 08:09:40 +0100 >>> >>> In master, I am sometimes getting errors like these: >>> >>> error in process sentinel: flymake--handle-report: Can=E2=80=99t find= state for flymake-cc in =E2=80=98flymake--state=E2=80=99 >>> error in process sentinel: Can=E2=80=99t find state for flymake-cc in= =E2=80=98flymake--state=E2=80=99 >>> error in process sentinel: flymake--handle-report: Can=E2=80=99t find= state for flymake-cc in =E2=80=98flymake--state=E2=80=99 >>> error in process sentinel: Can=E2=80=99t find state for flymake-cc in= =E2=80=98flymake--state=E2=80=99 >>> error in process sentinel: flymake--handle-report: Can=E2=80=99t find= state for flymake-cc in =E2=80=98flymake--state=E2=80=99 >>> error in process sentinel: Can=E2=80=99t find state for flymake-cc in= =E2=80=98flymake--state=E2=80=99 >>> >>> when working with C files. >>> >>> I haven't configured anything for Flymake myself. I think Flymake gets >>> involved by using Eglot. The errors apparently don't prevent flymake >>> from working later on. >>> >>> I have looked around in flymake docs and source, but I can't figure out >>> what's wrong. >> >> It would be helpful if you could provide a minimal reproduction starting >> from "emacs -q". > > I know, but I can't reproduce it at will. And debug-on-error didn't help > catch it in the act, maybe there is some condition-case involved > somewhere that should have better been a condition-case-unless-debug. > >> My immediate suspicion is that flymake-mode is (somehow) enabled in your >> C files while flymake-diagnostic-functions is set to contain flymake-cc, >> which causes flymake-cc to start up a background process. Then, >> flymake-mode is enabled again by eglot--managed-mode, which causes >> flymake--state to be cleared, so when flymake-cc tries to report >> diagnostics from that background process through flymake--handle-report, >> it fails. >> >> But I can't be sure whether this is due to a bug in Emacs or due to a >> bug in your config without a more minimal reproduction. > > No config using flymake and none for eglot. The only thing I did is > put eglot-ensure on c-mode-common-hook. > > Maybe I can catch it in LLDB somehow, but that will have to wait a bit, > unfortunately. > > Anyway, thanks for the replay. This issue bothered me as well. Here's a recipe for reproducing on master, with emacs -Q: 1. (add-hook 'c-mode-hook 'flymake-mode) 2. (add-hook 'c-mode-hook 'eglot-ensure) 3. Find some C file This happens because Eglot _restarts_ flymake-mode while flymake-cc's process is already running. Here's a simple fix: diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index a893a8d749a..c9e1bb7b52d 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2040,7 +2040,7 @@ eglot--managed-mode (unless (eglot--stay-out-of-p 'imenu) (add-function :before-until (local 'imenu-create-index-function) #'eglot-imenu)) - (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1)) + (unless (or (eglot--stay-out-of-p 'flymake) flymake-mode) (flymake-mod= e 1)) (unless (eglot--stay-out-of-p 'eldoc) (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function nil t)