Subject: Re: bug#61350: Eglot over Tramp freezes with large project

From: João Távora <[email-masked]>
Date: Tue, 7 Mar 2023 14:03:34 +0000

On Tue, Mar 7, 2023 at 1:52 PM Michael Albinus <[email-masked]> wrote:
> >      [In accept-process-output, ] If PROCESS is
> >      non-‘nil’ then this function does not return until some output has
> >                                                  [^^^^^^^^^^^^^^^^^]
> >      been received from PROCESS or PROCESS has closed the connection.
> >
> >
> > Note "some", not "all".  So while less common, I think the hang
> > can still happen.
> >
> > So maybe you meant:
> >
> >    (while (accept-process-output p 0 nil t))
> >
> > as suggested in that section?
>
> That was my first idea as well. But tramp-accept-process-output itself is
> called in a loop, so there's no difference in practice[1].

Hmmm, I still don't think they are equivalent.  In tramp-a-p-o with
TIMEOUT set to nil is where it normally hangs, right?  Well then, if
it does hang it will _not_ be called in a loop, by definition.

So the prior "hang removal" a-p-o call that you added must _still_
be made in a loop  itself to ensure that the outher existing inner
call:

  (accept-process-output tprocess nil nil t)

will not block due to the conditions you described.

Regardless, if this were my code. I'd put a big fat FIXME there
explaining that I want to remove the JUST-THIS-ONE, but I'm
afraid to :-)

> [1]: In theory, there's no difference between theory and practice. In
> practice, there is. :-)

hehe :-)

> Pls give my patch testing, in order to see whether Tramp still blocks.

I will do that later.  But 10 out of 10 successes in your testing is
a pretty solid indication that this is on the right track.

João