Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 292471 - app-editors/emacs[gtk] crashes on X disconnect (was: reconnection to emacs-daemon failed)
Summary: app-editors/emacs[gtk] crashes on X disconnect (was: reconnection to emacs-da...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: GNU Emacs project
URL: https://bugzilla.gnome.org/show_bug.c...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-09 04:40 UTC by Mathieu Z
Modified: 2016-04-24 07:36 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Z 2009-11-09 04:40:36 UTC
After quitting emacsclient -c with C-x C-c, another run refuse to start with out restarting /etc/init.d/emacs.${user}.

On the other hand, running emacs --daemon failed because it detects existing process.

Reproducible: Always

Steps to Reproduce:
1. /etc/init.d/emacs.${user} start
2. emacsclient -c ... do something, then quit
3. emacsclient -c gives:

Actual Results:  
output "Waiting for Emacs...", then falls back to prompt without a new frame open.
To fix must restart /etc/init.d/emacs.${user} restart.

Expected Results:  
Open a new frame.
Comment 1 Sebastian Luther (few) 2009-11-09 07:36:24 UTC
Please provide "emerge --info app-editors/emacs".
Comment 2 Mathieu Z 2009-12-14 01:01:53 UTC
emerge --info app-editors/emacs
Portage 2.1.7.13 (default/linux/amd64/10.0, gcc-4.4.2, glibc-2.11-r1, 2.6.32-gentoo x86_64)
=================================================================                          
                         System Settings                                                   
=================================================================                          
System uname: Linux-2.6.32-gentoo-x86_64-AMD_Athlon-tm-_64_Processor_3200+-with-gentoo-2.0.1
Timestamp of tree: Sat, 12 Dec 2009 10:00:01 +0000                                          
ccache version 2.4 [enabled]                                                                
app-shells/bash:     4.0_p35                                                                
dev-java/java-config: 2.1.10                                                                
dev-lang/python:     2.6.4, 3.1.1-r1                                                        
dev-util/ccache:     2.4-r8                                                                 
dev-util/cmake:      2.8.0                                                                  
sys-apps/baselayout: 2.0.1                                                                  
sys-apps/openrc:     0.5.3                                                                  
sys-apps/sandbox:    2.2                                                                    
sys-devel/autoconf:  2.13, 2.64                                                             
sys-devel/automake:  1.8.5-r3, 1.9.6-r2, 1.10.3, 1.11.1                                     
sys-devel/binutils:  2.20                                                                   
sys-devel/gcc-config: 1.4.1                                                                 
sys-devel/libtool:   2.2.6b                                                                 
virtual/os-headers:  2.6.30-r1                                                              
ACCEPT_KEYWORDS="amd64 ~amd64"                                                              
ACCEPT_LICENSE="* -@EULA"                                                                   
CBUILD="x86_64-pc-linux-gnu"                                                                
CFLAGS="-march=athlon64 -O2 -pipe"                                                          
CHOST="x86_64-pc-linux-gnu"                                                                 
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"                                  
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"                            
CXXFLAGS="-march=athlon64 -O2 -pipe"                                                                      
DISTDIR="/usr/portage/distfiles"                                                                          
EMERGE_DEFAULT_OPTS="--keep-going"                                                                        
FEATURES="assume-digests ccache distlocks fixpackages metadata-transfer news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"                                            
GENTOO_MIRRORS="http://gentoo.osuosl.org/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en ja zh zh_CN zh_TW en_US en_GB"
MAKEOPTS="-j3 --load-average"
PKGDIR="/usr/portage//packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage/"
PORTDIR_OVERLAY="/usr/local/portage/layman/java-overlay /usr/local/portage/layman/sunrise /usr/local/portage/layman/mpd /usr/local/portage/layman/x11 /usr/local/portage/layman/gentoo-taiwan /usr/local/portage/layman/desktop-effects /usr/local/portage/layman/gentoo-china /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac aalib acl acpi aim alsa amd64 apache2 audiofile avahi bash-completion bcmath berkdb bidi bittorrent blas bluetooth bzip2 cairo calendar caps cdaudio cddb cdparanoia cdr cjk cleartype cli cracklib crypt cscope css ctype cups curl curlwrappers cxx dbus dbx dga directfb djvu dri dts dv dvd dvdr dvdread dvi eds emacs emacs-w3 encode enscript evo exif expat fam fastcgi fbcon ffmpeg fftw flac flash fontconfig foomaticdb fortran freetds ftp fuse gd gdbm ginac glib glitz glut gnome gnome-keyring gnuplot gnutls gphoto2 gpm gps gs gsl gstreamer gtk gtkhtml gzip hal htmlhandbook httpd iconv icq icu idn ieee1394 imagemagick imap imlib immqt-bc innodb ipod ipv6 jabber java java5 java6 javascript jingle joystick jpeg jpeg2k kde4 kpathsea lame lapack latex lcms libcaca libgda libnotify lm_sensors lzo m17n-lib mad matroska mime mmx mmxext mng modplug modules mp3 mp4 mpeg mpi mplayer msn mtp mudflap multilib musepack musicbrainz mysql mysqli nautilus ncurses netboot nis nls nntp nptl nptlonly nsplugin odbc ogg openal openexr opengl openmp osc oscar pae pam pch pcre pda pdf perl php plasma plotutils png posix postgres ppds pppd pulseaudio python qq qt3support qt4 quicktime readline recode reflection rss ruby samba scanner sdl semantic-desktop session simplexml slang sndfile sockets socks5 speex spell spl sqlite sqlite3 sse sse2 ssl svg sysfs t1lib taglib tcl tcpd theora threads tidy tiff timidity truetype tta udev unicode upnp usb v4l v4l2 vcd vhosts vim-syntax vorbis wavepack webkit wlm wma wmf wmp wxwindows x264 x86emu xcb xcomposite xforms xft xine xinerama xml xorg xosd xsl xulrunner xv xvid yahoo zip zlib" ALSA_CARDS="emu10k1 emu10k1x" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache charset_lite dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="worker" ELIBC="glibc" INPUT_DEVICES="evdev joystick keyboard mouse wacom virtualbox vmmouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en ja zh zh_CN zh_TW en_US en_GB" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon vesa vga fbdev virtualbox vmware"
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

app-editors/emacs-23.1-r2 was built with the following:
USE="X alsa dbus gpm gtk jpeg m17n-lib (multilib) png svg tiff xft xpm -Xaw3d -gif -gzip-el -hesiod -kerberos -motif -sound -source -toolkit-scroll-bars"
Comment 3 Ulrich Müller gentoo-dev 2009-12-14 07:59:42 UTC
Does this also happen with an empty/nonexistent ~/.emacs file?
Comment 4 Christian Faulhammer (RETIRED) gentoo-dev 2009-12-14 08:22:56 UTC
This may be related to http://forums.gentoo.org/viewtopic.php?p=6092640
Comment 5 Ulrich Müller gentoo-dev 2010-01-12 15:50:38 UTC
(In reply to comment #3)
> Does this also happen with an empty/nonexistent ~/.emacs file?

No answer, and I cannot reproduce the problem.
Please reopen this bug if this is still an issue.
Comment 6 Mathieu Z 2010-01-15 06:36:33 UTC
(In reply to comment #3)
> Does this also happen with an empty/nonexistent ~/.emacs file?
> 

Sorry, didn't see that reply.  Yes it still happen after renameing .emacs to .emacs~ and rm -rf .emacs.d/:
$ sudo /etc/init.d/emacs.${USER} start
 * Caching service dependencies ...                                                        [ ok ]
 * Starting Emacs daemon for user xxxxx ...                                                        [ ok ]
$ emacsclient -c
Waiting for Emacs...
[A FRAME IS OPENED, PRESSED C-X, C-C TO QUIT]
$ emacsclient -c
Waiting for Emacs...
[NO FRAME OPEN, FALLS BACK TO PROMPT]
$ sudo /etc/init.d/emacs.${USER} restart
 * Stopping Emacs daemon for user xxxxx ...
 * start-stop-daemon: no matching processes found                                                   [ ok ]
 * Starting Emacs daemon for user xxxxx ...                                                        [ ok ]
$ emacsclient -c
Waiting for Emacs...
$ emacsclient -c
Waiting for Emacs...
[NO FRAME OPEN, FALLS BACK TO PROMPT]
$
Comment 7 Ulrich Müller gentoo-dev 2010-01-15 08:06:48 UTC
I still can't reproduce this, so here are some questions:

- Does the problem also occur if you exit the frame with "C-x 5 0" instead
  of "C-x C-c"?
- Does the description that you get with "C-h k C-x C-c" say
  "save-buffers-kill-emacs" or "save-buffers-kill-terminal"?
- What window manager are you using?
Comment 8 Mathieu Z 2010-01-15 10:56:26 UTC
(In reply to comment #7)
> I still can't reproduce this, so here are some questions:
> 
> - Does the problem also occur if you exit the frame with "C-x 5 0" instead
>   of "C-x C-c"?
Yes, I also killed with C-x 5 0, same result

> - Does the description that you get with "C-h k C-x C-c" say
>   "save-buffers-kill-emacs" or "save-buffers-kill-terminal"?
save-buffers-kill-terminal

> - What window manager are you using?
> 
KWin/KDE4

I just also tried doing the same thing via X11Forwarding on another computer (Ubuntu Karmic) with a different window manager (GNOME/Compiz), and there was no problem.

Comment 9 Christian Faulhammer (RETIRED) gentoo-dev 2010-01-16 17:12:26 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > I still can't reproduce this, so here are some questions:
> > 
> > - Does the problem also occur if you exit the frame with "C-x 5 0" instead
> >   of "C-x C-c"?
> Yes, I also killed with C-x 5 0, same result
> 
> > - Does the description that you get with "C-h k C-x C-c" say
> >   "save-buffers-kill-emacs" or "save-buffers-kill-terminal"?
> save-buffers-kill-terminal
> 
> > - What window manager are you using?
> > 
> KWin/KDE4
> 
> I just also tried doing the same thing via X11Forwarding on another computer
> (Ubuntu Karmic) with a different window manager (GNOME/Compiz), and there was
> no problem.

 I tried to reproduce in my chroot with KDE 4 but it worked for me.  Does it work as root for you?
Comment 10 Mathieu Z 2010-01-27 10:10:33 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > I still can't reproduce this, so here are some questions:
> > > 
> > > - Does the problem also occur if you exit the frame with "C-x 5 0" instead
> > >   of "C-x C-c"?
> > Yes, I also killed with C-x 5 0, same result
> > 
> > > - Does the description that you get with "C-h k C-x C-c" say
> > >   "save-buffers-kill-emacs" or "save-buffers-kill-terminal"?
> > save-buffers-kill-terminal
> > 
> > > - What window manager are you using?
> > > 
> > KWin/KDE4
> > 
> > I just also tried doing the same thing via X11Forwarding on another computer
> > (Ubuntu Karmic) with a different window manager (GNOME/Compiz), and there was
> > no problem.
> 
>  I tried to reproduce in my chroot with KDE 4 but it worked for me.  Does it
> work as root for you?
> 

This is interesting. After su, if I run emacs, works fine. If I run emacsclient -c, it tells me
Waiting for Emacs...
*ERROR*: Display :0.0 can't be opened
Comment 11 Ulrich Müller gentoo-dev 2010-01-27 10:31:44 UTC
(In reply to comment #10)
> This is interesting. After su, if I run emacs, works fine. If I run
> emacsclient -c, it tells me
> Waiting for Emacs...
> *ERROR*: Display :0.0 can't be opened

Typical problem with su is that the XAUTHORITY environment variable isn't set. You could try to set (and export) it manually.
Comment 12 Mathieu Z 2010-01-27 13:04:55 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > This is interesting. After su, if I run emacs, works fine. If I run
> > emacsclient -c, it tells me
> > Waiting for Emacs...
> > *ERROR*: Display :0.0 can't be opened
> 
> Typical problem with su is that the XAUTHORITY environment variable isn't set.
> You could try to set (and export) it manually.
> 

It's set alright, because 'emacs' works under su, but not 'emacsclient -c'
Comment 13 Ulrich Müller gentoo-dev 2010-10-21 09:02:03 UTC
I wonder if the upstream discussion at <http://thread.gmane.org/gmane.emacs.devel/131880> is related to this bug.

Does the problem still occur if you compile Emacs with USE="Xaw3d -gtk -motif"?
Comment 14 Christian Faulhammer (RETIRED) gentoo-dev 2010-11-14 12:06:52 UTC
(In reply to comment #13)
> I wonder if the upstream discussion at
> <http://thread.gmane.org/gmane.emacs.devel/131880> is related to this bug.
> 
> Does the problem still occur if you compile Emacs with USE="Xaw3d -gtk -motif"?

 Mathieu, could you please test?
Comment 15 Mathieu Z 2010-11-15 10:32:29 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > I wonder if the upstream discussion at
> > <http://thread.gmane.org/gmane.emacs.devel/131880> is related to this bug.
> > 
> > Does the problem still occur if you compile Emacs with USE="Xaw3d -gtk -motif"?
> 
>  Mathieu, could you please test?
> 

Indeed, turning off gtk support allow me to quit/restart the client without crash:

BEFORE:
$ emacsclient -c
Waiting for Emacs...
$ emacsclient -c
emacsclient: connect: Connection refused
emacsclient: No socket or alternate editor.  Please use:

	--socket-name
	--server-file      (or environment variable EMACS_SERVER_FILE)
	--alternate-editor (or environment variable ALTERNATE_EDITOR)
$ /etc/init.d/emacs.mzhang status
 * status: crashed

AFTER:
$ sudo /etc/init.d/emacs.users restart
$ emacsclient -c
Waiting for Emacs...
$ emacsclient -c
Waiting for Emacs...
$ emacsclient -c
Waiting for Emacs...
$ emacsclient -c
Waiting for Emacs...  
$ emacsclient -c
Waiting for Emacs...
Comment 16 Christian Faulhammer (RETIRED) gentoo-dev 2010-11-15 10:58:15 UTC
(In reply to comment #15)
> (In reply to comment #14)
> > (In reply to comment #13)
> > > I wonder if the upstream discussion at
> > > <http://thread.gmane.org/gmane.emacs.devel/131880> is related to this bug.
> > > 
> > > Does the problem still occur if you compile Emacs with USE="Xaw3d -gtk -motif"?
> > 
> >  Mathieu, could you please test?
> > 
> 
> Indeed, turning off gtk support allow me to quit/restart the client without
> crash:

 Great. :( So this bug resides in Gtk+ and not Emacs, but since 2006 there has been no movement on the upstream bug.
Comment 17 Ulrich Müller gentoo-dev 2010-11-15 11:04:07 UTC
I wonder if we should switch the logic for gtk and Xaw3d flags:

    Xaw3d? ( x11-libs/Xaw3d )
    !Xaw3d? (
        gtk? ( x11-libs/gtk+:2 )
        !gtk? ( motif? ( x11-libs/openmotif ) )
    )

That is, prefer Lucid/Athena over Gimp Toolkit in case the user has both USE flags set. And maybe also print a warning with USE=gtk.
Comment 18 Christian Faulhammer (RETIRED) gentoo-dev 2010-11-15 12:15:31 UTC
(In reply to comment #17)
> I wonder if we should switch the logic for gtk and Xaw3d flags:
> 
>     Xaw3d? ( x11-libs/Xaw3d )
>     !Xaw3d? (
>         gtk? ( x11-libs/gtk+:2 )
>         !gtk? ( motif? ( x11-libs/openmotif ) )
>     )
> 
> That is, prefer Lucid/Athena over Gimp Toolkit in case the user has both USE
> flags set. And maybe also print a warning with USE=gtk.

 I still would like to prefer Gtk+ toolkit, the warning should be included though.  Gnome team, we have a failure with GNU Emacs due to a bug in Gtk+, which is reported but unfixed upstream, to sum it up.
Comment 19 Gilles Dartiguelongue gentoo-dev 2010-11-16 11:51:21 UTC
I think this bug was reported to us exactly the same way years ago and it got closed with resolution "upstream" since none of us were using emacs. If there are more patches to add to the ebuild, that can be done, but failing that, there is little we can do to help.
Comment 20 Gilles Dartiguelongue gentoo-dev 2010-11-19 09:46:33 UTC
I think it was bug #272201. Correct me if I'm wrong but it looks similar.
Comment 21 Ulrich Müller gentoo-dev 2010-11-19 10:47:25 UTC
(In reply to comment #20)
> I think it was bug #272201. Correct me if I'm wrong but it looks similar.

No, that was an issue related to fonts, therefore different from this one.
Comment 22 Ulrich Müller gentoo-dev 2011-07-01 20:00:43 UTC
Problem still exists with emacs-vcs (bzr trunk as of today, revision 104859) and gtk+-3.0.11.
Comment 23 Judge Dredd 2016-04-23 17:58:22 UTC
(In reply to Mathieu Zhang from comment #12)
> (In reply to comment #11)
> > (In reply to comment #10)
> > > This is interesting. After su, if I run emacs, works fine. If I run
> > > emacsclient -c, it tells me
> > > Waiting for Emacs...
> > > *ERROR*: Display :0.0 can't be opened
> > 
> > Typical problem with su is that the XAUTHORITY environment variable isn't set.
> > You could try to set (and export) it manually.
> > 
> 
> It's set alright, because 'emacs' works under su, but not 'emacsclient -c'

Got the same problem here on amd64,though on x86 everything works fine.
I have to note that I haven't updated my x86 system for a few months and amd64 is fresh install.