From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy Date: Tue, 06 Sep 2022 15:22:27 +0300 Message-ID: <83czc8k7zw.fsf@gnu.org> References: <86czouksh2.fsf@protected.rcdrun.com> <83mtnykpij.fsf@gnu.org> <87tui5fdku.fsf@gnus.org> <83y27hjhy2.fsf@gnu.org> <87r10uvxr9.fsf@gnus.org> <83o7vyowcl.fsf@gnu.org> <87czceufj1.fsf@gnus.org> <83ilm6osqz.fsf@gnu.org> <87sflaszct.fsf@gnus.org> <874jxpevb6.fsf@gmail.com> <838rn1q3g9.fsf@gnu.org> <87edwsiy9p.fsf@gnus.org> <87a67d1vyg.fsf@gnus.org> <83ilm1jkss.fsf@gnu.org> <87v8q1b2ij.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30807"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, bugs@gnu.support, 50849@debbugs.gnu.org To: stefankangas@gmail.com, Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 06 14:47:15 2022 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 1oVXyz-0007l9-Up for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Sep 2022 14:47:14 +0200 Original-Received: from localhost ([::1]:57740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVXyy-0008Uz-Jd for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Sep 2022 08:47:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVXbi-0005gP-Ok for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2022 08:23:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33066) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVXba-0003vv-Ku for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2022 08:23:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oVXba-0006h1-DP for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2022 08:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Sep 2022 12:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50849 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 50849-submit@debbugs.gnu.org id=B50849.166246697725701 (code B ref 50849); Tue, 06 Sep 2022 12:23:02 +0000 Original-Received: (at 50849) by debbugs.gnu.org; 6 Sep 2022 12:22:57 +0000 Original-Received: from localhost ([127.0.0.1]:49998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oVXbU-0006gS-ND for submit@debbugs.gnu.org; Tue, 06 Sep 2022 08:22:57 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oVXbS-0006gE-J8 for 50849@debbugs.gnu.org; Tue, 06 Sep 2022 08:22:55 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVXbN-0003pq-1f; Tue, 06 Sep 2022 08:22:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=DA9ycrfzRbwTqkrwjWACz0L/w1z1RDXL4xMlGsUlsJE=; b=YbCPXdliYoZVwg0XUjBR ZDR42RaOqFsd9A3sVEEr9/ejUp4qTHs8kKf+3fVF5XCC/QbWsI5AmrOWejR8pGUEWYlKIIciXs8fa zzEBGC6rMZuwynC8FbkJsxqo7Ec/V7CnUZzKKoDD+/RCYY3jww0A7AuCinJSGUcoZfVv9vr7v9z73 Mo+luvfHUNnEDcl7zdEcZeRkDFSVHAR+TaQSgaN8Wi+K/wB9/dr/cBXNlxP84QLZp67UPEn81jGSg oTMYjjV3W8fMTZDhLxjVdXV4zMzoxQ+ZlDATcIzilnRtdpMKKSbVbg0SdF1sRwv0/ggJVBTbSh9Ca vob141dOyZfUbQ==; Original-Received: from [87.69.77.57] (port=1962 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVXbM-0005Xz-HC; Tue, 06 Sep 2022 08:22:48 -0400 In-Reply-To: <87v8q1b2ij.fsf@gmail.com> (message from Visuwesh on Tue, 06 Sep 2022 09:03:24 +0530) 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" Xref: news.gmane.io gmane.emacs.bugs:241644 Archived-At: > From: Visuwesh > Cc: Stefan Kangas , 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...