Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel

From: [email-masked]
Date: Sat, 23 Mar 2024 14:02:02 +0000 (UTC)

> From: Gerd Möllmann <[email-masked]>
> 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’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
> 
> 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".

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.