GNU bug report logs - #50849
28.0.50; Proposal for Emacs daemon to signal when being busy

Previous Next

Package: emacs;

Reported by: Jean Louis <bugs <at> gnu.support>

Date: Mon, 27 Sep 2021 14:28:02 UTC

Severity: wishlist

Tags: patch

Found in version 28.0.50

Fixed in version 29.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #84 received at 50849 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: stefankangas <at> gmail.com, Visuwesh <visuweshm <at> gmail.com>
Cc: larsi <at> gnus.org, bugs <at> gnu.support, 50849 <at> debbugs.gnu.org
Subject: Re: bug#50849: 28.0.50; Proposal for Emacs daemon to signal when
 being busy
Date: Tue, 06 Sep 2022 15:22:27 +0300
> From: Visuwesh <visuweshm <at> gmail.com>
> Cc: Stefan Kangas <stefankangas <at> gmail.com>,  larsi <at> gnus.org,
>   bugs <at> gnu.support,  50849 <at> debbugs.gnu.org
> Date: Tue, 06 Sep 2022 09:03:24 +0530
> 
> [செவ்வாய் செப்டம்பர் 06, 2022] Eli Zaretskii wrote:
> 
> >> If someone could check if this works on MS-Windows, that would be
> >> appreciated.
> >
> > How would one test it, please?  Do you have any recipe?
> 
> Here's what I did to test it,
> 
>     % src/emacs -Q --daemon
>     Starting Emacs daemon.
>     % emacsclient --eval '(while t)' &
>     [1] 2700
>     % emacsclient -c --timeout=2
>     Waiting for Emacs...
>     Server not responding; timed out after 2 seconds
>     % emacsclient -c
>     Waiting for Emacs...
>     Server not responding; use Ctrl+C to break  C-c C-c

Thanks.

In fact, one can test this much more easily:

  emacs -Q &
  M-x server-start RET

  emacsclient -w N SOME-FILE
  Waiting for Emacs...

Observe that SOME-FILE is displayed by the server in a client frame.

Now wait for N seconds without doing anything and observe:

  Server not responding; use Ctrl+C to break

IOW, emacsclient _always_ reports a timeout after N seconds, even
though the server did act upon the client request.

Looking at the code, I don't understand how this was supposed to
work.  After sending the request to the server, we call recv in a
loop, waiting for a response.  But in a normal session, the server
will only respond when the user is done with editing the file, which
could be after a very long time.  So this _must_ time out.

I think to make this work, the client-server protocol should be
changed so that the server responds with some kind of positive
response right after it receives the initial request.  And that would
make the protocol backward-incompatible, unfortunately.

Alternatively, perhaps some different change in set_socket and its
subroutines could be used?  Isn't that where we get stuck if the
server is busy?  But I'm really out of my depth here, so would socket
experts please chime in?

And another comment: the documentation says that the default time out
is zero, i.e. no timeout, but that's not true: the default timeout is
actually 30 sec.  So if someone uses the client of the master branch,
it will now always terminate due to timeout after 30 sec...




This bug report was last modified 2 years and 256 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.