From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thomas Fitzsimmons Newsgroups: gmane.emacs.devel Subject: Re: Log out hanging after X-forwarded emacsclient Date: Tue, 09 Apr 2024 01:07:03 -0400 Message-ID: References: <83zhbcg6s4.fsf@gnu.org> <87r1wng2ki.fsf@linaro.org> <83o8rrenn1.fsf@gnu.org> <87blnr6uck.fsf@tullinup.koldfront.dk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29142"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 09 07:07:54 2024 Return-path: Envelope-to: ged-emacs-devel@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 1ru3i6-0007MD-5t for ged-emacs-devel@m.gmane-mx.org; Tue, 09 Apr 2024 07:07:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ru3hP-0001Re-1F; Tue, 09 Apr 2024 01:07:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ru3hN-0001EP-8a for emacs-devel@gnu.org; Tue, 09 Apr 2024 01:07:09 -0400 Original-Received: from mail.fitzsim.org ([69.165.165.189]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ru3hL-000641-0f for emacs-devel@gnu.org; Tue, 09 Apr 2024 01:07:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fitzsim.org ; s=20220430; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=3Xcl0TaThbrKwkp9XOL9RicOYUKg+Dn0vH5YLOJVA1k=; b=eodFYvRSeBhasGCy6ZhDy3F8JM ZsnT0erIMZSL0fdDCqE9KyZWHaj624N1/KfIa7AYK7dTYeTupIhWMbMXjp7oGD8WFtg19kMsXQj/C fc2LChnl515s9YhwdkfqbL4nn2OuexdiSckfIixWS8I/l78six2iDnnM4jPGq4PcHWWj8T/nYEpaw +lvL5ds64tcwqreYxhzSmQfWbzm/Db9RTGeVFdeTIZPh0NSQAtjZCJcNT1AQ9x3/cLzlpIR86JZbH EX+qWoO0o1QcDT4rnpQEwexUoPPglcTHdv5jkPBaRZAhwxrGLR5DnADScG9P2F00VllN1dlBa8edX n3ExYxDw==; Original-Received: from [192.168.1.1] (helo=localhost.localdomain) by mail.fitzsim.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ru1Ho-000Jd9-1B for emacs-devel@gnu.org; Tue, 09 Apr 2024 01:07:04 -0400 In-Reply-To: <87blnr6uck.fsf@tullinup.koldfront.dk> ("Adam =?utf-8?B?U2o=?= =?utf-8?B?w4PCuGdyZW4=?= via \"Emacs development discussions."'s message of "Thu, 16 Apr 2020 22:36:43 +0200") Received-SPF: pass client-ip=69.165.165.189; envelope-from=fitzsim@fitzsim.org; helo=mail.fitzsim.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317638 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Adam, "Adam Sj=C3=B8gren " writes: > Inspired by the mention of the old GTK+-bug, I did a build of emacs like > this: > > ./configure --without-pop --with-cairo --without-dbus --with-x-toolkit= =3Dlucid && make bootstrap > > And then I started Emacs on the machine: > > machine1:~$ /usr/src/emacs/src/emacs -Q --eval '(server-start)' > > On another machine, I ssh'ed to the first machine, with X-forwarding > turned on, and started emacsclient: > > machine2:~$ ssh -X machine1 > machine1:~$ /usr/src/emacs/lib-src/emacsclient --create-frame /tmp/test= .txt > Waiting for Emacs... > > And got an X frame displayed on the screen of machine2, as expected. > > When I then end emacsclient with C-x # I'm back at the prompt. If I run > "exit", the prompt is hanging, where I would expect to be logged out of > machine1 and returned to machine2. Only after I press control-c do I get > the prompt back: > > machine1:~$ exit > ^C > machine2:~$=20 > > (When I press control-c, the message "Connection lost to X server > 'localhost:10.0'" is displayed in the mini-buffer in the Emacs frame on > machine1.) > > I thought this "hanging" was related to the display closing GTK+-bug, > but this is with lucid. At one point, I think, I read that it was a > dbus-related thing, but I also turned off dbus. > > How do I avoid this hanging/having to press control-c? This bug is still present on the master branch. The attached patch works for me but it may be subject to race conditions, so I will continue testing it. In the meantime, I figured I would reply to this old thread in case others are interested in trying it. Thomas --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Close-X-connection-when-emacsclient-disconnects.patch >From 21640257edc72e0c11127db60a6cfa9e92005309 Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Tue, 9 Apr 2024 01:00:14 -0400 Subject: [PATCH] Close X connection when emacsclient disconnects This fixes an issue reported on the mailing list: https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg00950.html * lisp/server.el (server-handle-delete-frame): If the frame is an X frame and DISPLAY is set, close the X connection to the display. --- lisp/server.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/server.el b/lisp/server.el index b65053267a6..fb236493eae 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -509,6 +509,9 @@ server-handle-delete-frame (eq proc (frame-parameter f 'client)))) (frame-list)))) (server-log (format "server-handle-delete-frame, frame %s" frame) proc) + (let ((display (frame-parameter frame 'display))) + (when (and display (eq (framep frame) 'x)) + (run-at-time nil nil (lambda () (x-close-connection display))))) (server-delete-client proc 'noframe)))) ; Let delete-frame delete the frame later. (defun server-handle-suspend-tty (terminal) -- 2.39.2 --=-=-=--