From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christoph Ruegge Newsgroups: gmane.emacs.bugs Subject: bug#18375: 24.4.50; Emacs hangs X session manager logout in certain cases Date: Sun, 31 Aug 2014 13:56:23 +0200 Message-ID: <87y4u4euu0.fsf@cxcs.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1409528010 15820 80.91.229.3 (31 Aug 2014 23:33:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 Aug 2014 23:33:30 +0000 (UTC) To: 18375@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 01 01:33:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XOEcb-0004CK-OH for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Sep 2014 01:33:21 +0200 Original-Received: from localhost ([::1]:51365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOEcb-0001vC-Cj for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Aug 2014 19:33:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOEcS-0001oT-A9 for bug-gnu-emacs@gnu.org; Sun, 31 Aug 2014 19:33:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOEcJ-0000tv-JI for bug-gnu-emacs@gnu.org; Sun, 31 Aug 2014 19:33:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35412) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOEcJ-0000tr-Gp for bug-gnu-emacs@gnu.org; Sun, 31 Aug 2014 19:33:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XOEcJ-0003Ol-9M for bug-gnu-emacs@gnu.org; Sun, 31 Aug 2014 19:33:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Christoph Ruegge Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Aug 2014 23:33:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18375 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.140952793812991 (code B ref -1); Sun, 31 Aug 2014 23:33:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 Aug 2014 23:32:18 +0000 Original-Received: from localhost ([127.0.0.1]:55207 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XOEbZ-0003NN-9j for submit@debbugs.gnu.org; Sun, 31 Aug 2014 19:32:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51960) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XO3kf-000331-CP for submit@debbugs.gnu.org; Sun, 31 Aug 2014 07:56:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XO3kU-00017r-3f for submit@debbugs.gnu.org; Sun, 31 Aug 2014 07:56:52 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51819) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XO3kT-00017n-UF for submit@debbugs.gnu.org; Sun, 31 Aug 2014 07:56:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XO3kN-0006kn-SG for bug-gnu-emacs@gnu.org; Sun, 31 Aug 2014 07:56:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XO3kH-000167-O7 for bug-gnu-emacs@gnu.org; Sun, 31 Aug 2014 07:56:39 -0400 Original-Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:40547) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XO3kH-00015q-Gq for bug-gnu-emacs@gnu.org; Sun, 31 Aug 2014 07:56:33 -0400 Original-Received: by mail-wi0-f172.google.com with SMTP id n3so11165507wiv.5 for ; Sun, 31 Aug 2014 04:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=TNaB9WPBKqgRJKl1w5VGsJ1d8BaioFbslKtT0RsVfP8=; b=jHuSvCOvv2hoMBXulXL5z4SvwN0mPvbWY5L+A/WYsqSbodOaZ6AVFBcz/pDgvoEIZm PoIL/J3a1Su7MwmC1KnfhLE1zyVYVSQAM7Ec1cn+yVg32kdddj7YQZgwSdhppGpKSQhP cJHm5c2ROaUsKXIgESt617EVcwH1k9NzQ3m6yZDpdp23nwHmzKf15b4Uvknf5fjoiRWB IzXZNL0q0YaZDvfdpIPqN0bsHc83upnfXoxUc5jmVBGHyfeLA5bw5pE3+i6xuNSiMFJK tM5L+53p3/HOtD1N+zDtBj1YqQAvwNilDTTMmdfi0WRBcHw5bE6cvhpDAwzVKJdPilyt e4aw== X-Received: by 10.180.92.134 with SMTP id cm6mr15495710wib.72.1409486192077; Sun, 31 Aug 2014 04:56:32 -0700 (PDT) Original-Received: from io (gtng-4d08a320.pool.mediaWays.net. [77.8.163.32]) by mx.google.com with ESMTPSA id ba3sm8939086wib.10.2014.08.31.04.56.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 31 Aug 2014 04:56:30 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Sun, 31 Aug 2014 19:32:14 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92909 Archived-At: I experience a bug that can be produced as follows: (1) start emacs -Q --daemon (2) open an X frame (3) close the frame (4) logout. The result is that the session manager (KDE's, in my case) logout hangs since Emacs does not respond to the logout signal. The bug does not occur if I logout before closing the frame, or open other frames and interact with Emacs in any way that does not lead to no frame being open at any given time (I can even close the first frame). Moreover, if I logout before opening any frame, the logout does not hang, but the Emacs process does not terminate. I investigated a bit and think the reason has something to do with the way the SM communication is tied to the first opened terminal. The connection is opened at the end of x_term_init() when the first terminal is opened (and is an X terminal). Once the last X frame is closed, the terminal is closed as well. I don't know precisely why this causes the bug, since the SM connection is supposed to be shut down in x_delete_display(), but I am pretty sure that the bug happens if and only if the first terminal has been closed. Far as I see, the bug occurs only on non-GTK toolkits, since for GTK the terminal is kept open to circumvent some GTK some bug, apparently. If I may add, the current behaviour is rather weird to begin with. The SM integration's purpose is to cleanly shutdown Emacs on logout, so it should be tied to the entire process and not to a particular terminal. There are essentially two scenarios for the Emacs daemon: it can be run outside a desktop session (in which case there should be no SM connection at all) or inside (in which case the connection should last for the lifetime of the process). A cleaner approach would therefore maybe be to seperate the SM connection from opening and closing the terminal and have it done at startup if the user wishes, maybe depending on a command line parameter, the presence of the DISPLAY variable, or after user init depending on some elisp variable. The connection itself could maybe be done through a dummy X terminal that is kept open all the time. I tried simpy adding a call to `x-open-connection' to startup.el, and this indeed fixes the bug (for one of the use cases). I'd be willing to try to write a patch for this, but as I'm not much of a programmer and do not really understand the way Emacs handles displays, it would likely not be up to quality standards. Best regards In GNU Emacs 24.4.50.16 (x86_64-unknown-linux-gnu) of 2014-08-30 on io Windowing system distributor `The X.Org Foundation', version 11.0.11600000 System Description: Arch Linux Configured using: `configure --prefix=/home/cs/.local --with-x-toolkit=no --without-gconf --without-gsettings Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS NOTIFY ACL GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB