unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: stefankangas@gmail.com, Visuwesh <visuweshm@gmail.com>
Cc: larsi@gnus.org, bugs@gnu.support, 50849@debbugs.gnu.org
Subject: bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy
Date: Tue, 06 Sep 2022 15:22:27 +0300	[thread overview]
Message-ID: <83czc8k7zw.fsf@gnu.org> (raw)
In-Reply-To: <87v8q1b2ij.fsf@gmail.com> (message from Visuwesh on Tue, 06 Sep 2022 09:03:24 +0530)

> From: Visuwesh <visuweshm@gmail.com>
> Cc: Stefan Kangas <stefankangas@gmail.com>,  larsi@gnus.org,
>   bugs@gnu.support,  50849@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...





  reply	other threads:[~2022-09-06 12:22 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 14:23 bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy Jean Louis
2021-09-27 15:27 ` Eli Zaretskii
2021-09-28  5:56   ` Lars Ingebrigtsen
2021-09-28  7:08     ` Eli Zaretskii
2022-09-02 11:09       ` Lars Ingebrigtsen
2022-09-02 11:21         ` Eli Zaretskii
2022-09-02 12:28           ` Lars Ingebrigtsen
2022-09-02 12:39             ` Eli Zaretskii
2022-09-02 12:44               ` Robert Pluim
2022-09-02 13:02               ` Lars Ingebrigtsen
2022-09-02 13:54                 ` Visuwesh
2022-09-02 14:02                   ` Eli Zaretskii
2022-09-03  9:48                     ` Lars Ingebrigtsen
2022-09-03 15:40                       ` Stefan Kangas
2022-09-03 15:57                         ` Eli Zaretskii
2022-09-04 10:59                         ` Lars Ingebrigtsen
2022-09-05 13:56                       ` Stefan Kangas
2022-09-05 19:07                         ` Lars Ingebrigtsen
2022-09-06  0:19                           ` Stefan Kangas
2022-09-06  2:31                             ` Eli Zaretskii
2022-09-06  3:33                               ` Visuwesh
2022-09-06 12:22                                 ` Eli Zaretskii [this message]
2022-09-06 14:02                                   ` Robert Pluim
2022-09-06 14:12                                     ` Eli Zaretskii
2022-09-06 14:20                                       ` Robert Pluim
2022-09-07  1:05                                   ` Stefan Kangas
2022-09-07  2:39                                     ` Eli Zaretskii
2022-09-07  8:18                                       ` Stefan Kangas
2022-09-07 10:34                                         ` Robert Pluim
2022-09-07 11:19                                           ` Eli Zaretskii
2022-09-08  1:47                                             ` Stefan Kangas
2022-09-08  5:59                                               ` Eli Zaretskii
2022-09-08 12:07                                                 ` Lars Ingebrigtsen
2022-09-08 13:42                                                   ` Eli Zaretskii
2022-09-08 13:46                                                     ` Lars Ingebrigtsen
2022-09-08 14:05                                                       ` Eli Zaretskii
2022-09-08 14:11                                                         ` Lars Ingebrigtsen
2022-09-08 14:15                                                           ` Eli Zaretskii
2022-09-08 14:19                                                             ` Robert Pluim
2022-09-08 16:02                                                               ` Eli Zaretskii
2022-09-09  8:47                                                                 ` Robert Pluim
2022-09-09  9:29                                                                   ` Stefan Kangas
2022-09-09  9:35                                                                     ` Robert Pluim
2022-09-09  9:38                                                                       ` Stefan Kangas
2022-09-09 11:31                                                                   ` Eli Zaretskii
2022-09-06  8:20                             ` Robert Pluim
2022-09-06  8:52                               ` Lars Ingebrigtsen
2022-09-03  1:07                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-03  9:49                   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83czc8k7zw.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=50849@debbugs.gnu.org \
    --cc=bugs@gnu.support \
    --cc=larsi@gnus.org \
    --cc=stefankangas@gmail.com \
    --cc=visuweshm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).