Subject: 24.0.90; Daemon crashes when client frame is closed

From: Wolodja Wentland <[email-masked]>
Date: Fri, 28 Oct 2011 15:45:50 +0100

Hi all,

the emacs daemon crashes every time I am closing a client frame. The
behaviour can be consistently reproduced with the following steps:

1. emacs --daemon
2. emacsclient -c
3. C-x 5 0              (in the client frame)

Emacs is running on a fully upgraded Debian sid system and was installed
from http://emacs.naquadah.org/

The daemon does *not* crash if I use "emacsclient -t" which is, however,
not really surprising given that the crash seems to be related to GTK
(see below).

System Information
==================
Package emacs-snapshot: i A 1:20111026-1                                                                    
Package emacs-snapshot-bin-common: i A 1:20111026-1
Package emacs-snapshot-common: i A 1:20111026-1                                                                    
Package emacs-snapshot-dbg: i   1:20111026-1

babilen@asasello: ~  $ aptitude versions ~i~nlibgtk
Package libgtk-3-0: i A 3.0.12-2                                                                        
Package libgtk-3-0-dbg: i   3.0.12-2                                                                         
Package libgtk-3-bin: i A 3.0.12-2                                                                        
Package libgtk-3-common: i A 3.0.12-2                                                                        
Package libgtk-vnc-1.0-0: i   0.4.3-6+b1                                                                      
Package libgtk-vnc-2.0-0: i A 0.4.3-6+b1                                                                      
Package libgtk2-perl: i A 2:1.223-1+b1                                                                    
Package libgtk2.0-0: i A 2.24.7-1                                                                         
Package libgtk2.0-bin: i A 2.24.7-1
Package libgtk2.0-common: i A 2.24.7-1   
Package libgtkglext1: id  1.2.0-2                                                                         
Package libgtkhtml3.14-19: i A 3.32.2-2                                                                        
Package libgtkmm-2.4-1c2a: i A 1:2.24.2-1                                                                      
Package libgtkmm-3.0-1: i A 3.0.1-1                                                                         
Package libgtkspell0: i A 2.0.16-1

gdb session
===========
 Reading symbols from /lib/x86_64-linux-gnu/libnsl.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/x86_64-linux-gnu/libnsl.so.1
Reading symbols from /lib/x86_64-linux-gnu/libnss_nis.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/x86_64-linux-gnu/libnss_nis.so.2
0x00007f2864e3de43 in select () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) source /home/babilen/src/extern/emacs/src/.gdbinit
Warning: /home/babilen/../lwlib: No such file or directory.
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not from terminal]
DISPLAY = :0
TERM = rxvt-unicode-256color
Breakpoint 1 at 0x505440: file emacs.c, line 385.
Temporary breakpoint 2 at 0x5209b0: file sysdep.c, line 855.
(gdb) continue
Continuing.
[New Thread 0x7f285e769700 (LWP 6894)]
[New Thread 0x7f285df68700 (LWP 6895)]

Program received signal SIGSEGV, Segmentation fault.
_gdk_x11_display_make_default (display=0x0) at /build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/x11/gdkdisplay-x11.c:1864
1864	/build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/x11/gdkdisplay-x11.c: No such file or directory.
	in /build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/x11/gdkdisplay-x11.c
(gdb) bt
#0  _gdk_x11_display_make_default (display=0x0) at /build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/x11/gdkdisplay-x11.c:1864
#1  0x00007f286a22784d in gdk_display_manager_set_default_display (manager=0x1c3d200, display=<optimized out>)
    at /build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/gdkdisplaymanager.c:323
#2  0x00007f286a244c97 in gdk_x11_display_dispose (object=<optimized out>) at /build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/x11/gdkdisplay-x11.c:1695
#3  0x00007f28692e7280 in g_object_run_dispose (object=0x1ac9000) at /build/buildd-glib2.0_2.28.8-1-amd64-O6EeLn/glib2.0-2.28.8/./gobject/gobject.c:945
#4  0x00007f286a2251aa in gdk_display_close (display=0x1ac9000) at /build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/gdkdisplay.c:269
#5  0x00000000004c0595 in x_delete_terminal (terminal=<optimized out>) at xterm.c:10611
#6  0x00000000004b3812 in Fdelete_terminal (terminal=30318725, force=<optimized out>) at terminal.c:345
#7  0x000000000042615e in delete_frame (frame=31282853, force=<optimized out>) at frame.c:1368
#8  0x000000000057d1ec in Ffuncall (nargs=<optimized out>, args=0x7fff223ebfb0) at eval.c:2977
#9  0x000000000057933c in Fcall_interactively (function=12078818, record_flag=12036610, keys=12082933) at callint.c:859
#10 0x000000000057d1d9 in Ffuncall (nargs=<optimized out>, args=0x7fff223ec1d0) at eval.c:2981
#11 0x000000000057d444 in call3 (fn=<optimized out>, arg1=<optimized out>, arg2=<optimized out>, arg3=<optimized out>) at eval.c:2774
#12 0x0000000000515ecc in command_loop_1 () at keyboard.c:1570
#13 0x000000000057b346 in internal_condition_case (bfun=0x515b30 <command_loop_1>, handlers=12088802, hfun=0x50a9b0 <cmd_error>) at eval.c:1499
#14 0x0000000000508e8e in command_loop_2 (ignore=<optimized out>) at keyboard.c:1158
#15 0x000000000057b228 in internal_catch (tag=Cannot access memory at address 0xffffffffffffffe0
) at eval.c:1256
#16 0x000000000050a487 in command_loop () at keyboard.c:1137
#17 recursive_edit_1 () at keyboard.c:757
#18 0x000000000050a7bc in Frecursive_edit () at keyboard.c:821
#19 0x000000000041756d in main (argc=2, argv=<optimized out>) at emacs.c:1706

Lisp Backtrace:
"delete-frame" (0x223ebfb8)
"call-interactively" (0x223ec1d8)
(gdb) bt full
#0  _gdk_x11_display_make_default (display=0x0) at /build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/x11/gdkdisplay-x11.c:1864
        display_x11 = 0x0
        startup_id = <optimized out>
#1  0x00007f286a22784d in gdk_display_manager_set_default_display (manager=0x1c3d200, display=<optimized out>)
    at /build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/gdkdisplaymanager.c:323
No locals.
#2  0x00007f286a244c97 in gdk_x11_display_dispose (object=<optimized out>) at /build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/x11/gdkdisplay-x11.c:1695
        display = 0x1ac9000
        display_x11 = 0x1ac9000
        i = <optimized out>
#3  0x00007f28692e7280 in g_object_run_dispose (object=0x1ac9000) at /build/buildd-glib2.0_2.28.8-1-amd64-O6EeLn/glib2.0-2.28.8/./gobject/gobject.c:945
        __PRETTY_FUNCTION__ = "g_object_run_dispose"
#4  0x00007f286a2251aa in gdk_display_close (display=0x1ac9000) at /build/buildd-gtk+3.0_3.0.12-2-amd64-rEYsqr/gtk+3.0-3.0.12/./gdk/gdkdisplay.c:269
        __PRETTY_FUNCTION__ = "gdk_display_close"
#5  0x00000000004c0595 in x_delete_terminal (terminal=<optimized out>) at xterm.c:10611
        dpyinfo = 0x1cf6200
#6  0x00000000004b3812 in Fdelete_terminal (terminal=30318725, force=<optimized out>) at terminal.c:345
        t = 0x1cea080
#7  0x000000000042615e in delete_frame (frame=31282853, force=<optimized out>) at frame.c:1368
        tmp = <optimized out>
        terminal = <optimized out>
        f = 0x1dd56a0
        sf = <optimized out>
        kb = 0x0
        minibuffer_selected = 0
        tooltip_frame = 0
#8  0x000000000057d1ec in Ffuncall (nargs=<optimized out>, args=0x7fff223ebfb0) at eval.c:2977
        fun = <optimized out>
        original_fun = <optimized out>
        funcar = <optimized out>
        numargs = <optimized out>
        lisp_numargs = <optimized out>
        val = <optimized out>
        backtrace = {
          next = 0x7fff223ec160, 
          function = 0x7fff223ebfb0, 
          args = 0x7fff223ebfb8, 
          nargs = 0, 
          debug_on_exit = 0
        }
        internal_args = 0x7fff223ebed0
        i = <optimized out>
#9  0x000000000057933c in Fcall_interactively (function=12078818, record_flag=12036610, keys=12082933) at callint.c:859
        val = <optimized out>
        args = 0x7fff223ebfb0
        visargs = <optimized out>
        specs = <optimized out>
        filter_specs = <optimized out>
        teml = <optimized out>
        up_event = 12036610
        enable = 12036610
        speccount = <optimized out>
        next_event = <optimized out>
        prefix_arg = 12036610
        string = <optimized out>
---Type <return> to continue, or q <return> to quit---
        tem = <optimized out>
        varies = 0x7fff223ebf80 ""
        i = <optimized out>
        nargs = <optimized out>
        foo = <optimized out>
        prompt1 = '\000' <repeats 17 times>, " ", '\000' <repeats 81 times>
        tem1 = <optimized out>
        arg_from_tty = <optimized out>
        key_count = 3
        record_then_fail = 0
        save_this_command = 12078818
        save_last_command = 12036610
        save_this_original_command = 12078818
        save_real_this_command = 12078818
#10 0x000000000057d1d9 in Ffuncall (nargs=<optimized out>, args=0x7fff223ec1d0) at eval.c:2981
        fun = <optimized out>
        original_fun = <optimized out>
        funcar = <optimized out>
        numargs = <optimized out>
        lisp_numargs = <optimized out>
        val = <optimized out>
        backtrace = {
          next = 0x0, 
          function = 0x7fff223ec1d0, 
          args = 0x7fff223ec1d8, 
          nargs = 3, 
          debug_on_exit = 0
        }
        internal_args = 0x7fff223ec1d8
        i = <optimized out>
#11 0x000000000057d444 in call3 (fn=<optimized out>, arg1=<optimized out>, arg2=<optimized out>, arg3=<optimized out>) at eval.c:2774
        ret_ungc_val = 17508464
        args = {12176834, 12078818, 12036610, 12036610}
#12 0x0000000000515ecc in command_loop_1 () at keyboard.c:1570
        scount = 2
        cmd = <optimized out>
        keybuf = {96, 212, 192, 4611686018427389952, 4294967295, 140733767928416, 140733767926576, 5751638, 139811467242592, 4243442, 139811467265680, 4202240, 0, 139811566908712, 139811566977024, 
          4242649, 139811467294720, 4218128, 4294967296, 4294968258, 276967387, 139811567138080, 0, 12036610, 64, 12287590, 140733767928136, 4611686018427518976, 12036610, 5682290}
        i = <optimized out>
        prev_modiff = 10
        prev_buffer = 0xb81790
#13 0x000000000057b346 in internal_condition_case (bfun=0x515b30 <command_loop_1>, handlers=12088802, hfun=0x50a9b0 <cmd_error>) at eval.c:1499
        val = <optimized out>
        c = {
          tag = 12036610, 
          val = 12036610, 
          next = 0x7fff223ec4f0, 
          gcpro = 0x0, 
          jmp = {{
              __jmpbuf = {12405840, 5089163193149408236, 12036610, 140733767928136, 4294967295, 140733767928416, -5089608594659621908, 5089163374265091052}, 
              __mask_was_saved = 0, 
              __saved_mask = {
                __val = {139811566977024, 0, 4294967295, 0, 1, 8641424, 0, 4294967295, 140733767928416, 0, 139811564959554, 1, 0, 0, 139811467265680, 0}
              }
            }}, 
---Type <return> to continue, or q <return> to quit---
          backlist = 0x0, 
          handlerlist = 0x0, 
          lisp_eval_depth = 0, 
          pdlcount = 2, 
          poll_suppress_count = 1, 
          interrupt_input_blocked = 0, 
          byte_stack = 0x0
        }
        h = {
          handler = 12088802, 
          var = 12036610, 
          chosen_clause = 12036610, 
          tag = 0x7fff223ec380, 
          next = 0x0
        }
#14 0x0000000000508e8e in command_loop_2 (ignore=<optimized out>) at keyboard.c:1158
        val = 17508464
#15 0x000000000057b228 in internal_catch (tag=Cannot access memory at address 0xffffffffffffffe0
) at eval.c:1256
        c = {
          tag = 12084594, 
          val = 12036610, 
          next = 0x0, 
          gcpro = 0x0, 
          jmp = {{
              __jmpbuf = {12405840, 5089163193149408236, 12036610, 140733767928136, 4294967295, 140733767928416, -5089608594575735828, 5089163374159709164}, 
              __mask_was_saved = 0, 
              __saved_mask = {
                __val = {0, 0, 0, 0, 0, 352, 6042473, 15195128, 140733767927336, 344, 140733767927328, 6329507, 12036610, 12262562, 5761670, 14}
              }
            }}, 
          backlist = 0x0, 
          handlerlist = 0x0, 
          lisp_eval_depth = 0, 
          pdlcount = 2, 
          poll_suppress_count = 1, 
          interrupt_input_blocked = 0, 
          byte_stack = 0x0
        }
#16 0x000000000050a487 in command_loop () at keyboard.c:1137
No locals.
#17 recursive_edit_1 () at keyboard.c:757
        count = 1
        val = 12036610
#18 0x000000000050a7bc in Frecursive_edit () at keyboard.c:821
        count = 0
        buffer = 12036610
#19 0x000000000041756d in main (argc=2, argv=<optimized out>) at emacs.c:1706
        dummy = 2284271
        stack_bottom_variable = 0 '\000'
        do_initial_setlocale = <optimized out>
        skip_args = 1
        rlim = {
          rlim_cur = 8720000, 
          rlim_max = 18446744073709551615
        }
---Type <return> to continue, or q <return> to quit---
        no_loadup = 0
        junk = 0x0
        dname_arg = 0x0
        ch_to_dir = 0x913b3 <Address 0x913b3 out of bounds>

Lisp Backtrace:
"delete-frame" (0x223ebfb8)
"call-interactively" (0x223ec1d8)
(gdb) xbacktrace
"delete-frame" (0x223ebfb8)
"call-interactively" (0x223ec1d8)
(gdb)

--- snip ---

In GNU Emacs 24.0.90.1 (x86_64-pc-linux-gnu, GTK+ Version 3.0.12)
 of 2011-10-26 on zelenka, modified by Debian
 (emacs-snapshot package, version 1:20111026-1)
Windowing system distributor `The X.Org Foundation', version 11.0.11101901
configured using `configure  '--build' 'x86_64-linux-gnu' '--host' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.0.90/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.0.90/site-lisp:/usr/share/emacs/site-lisp' '--without-compress-info' '--with-crt-dir=/usr/lib/x86_64-linux-gnu/' '--with-x=yes' '--with-x-toolkit=gtk3' '--with-imagemagick=yes' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  ido-everywhere: t
  evil-mode: t
  evil-local-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  show-paren-mode: t
  global-hl-line-mode: t
  global-linum-mode: t
  linum-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o <tab> r <tab> <return>

Recent messages:
Loading /etc/emacs/site-start.d/50dpkg-dev-el.el (source)...done
Loading /etc/emacs/site-start.d/50elserv.el (source)...done
Loading /etc/emacs/site-start.d/50emacs-goodies-el.el (source)...done
Loading /etc/emacs/site-start.d/50flim.el (source)...done
Loading /etc/emacs/site-start.d/50lbdb.el (source)...done
Loading /etc/emacs/site-start.d/50psvn.el (source)...done
Loading /etc/emacs/site-start.d/51debian-el.el (source)...done
Loading /home/babilen/.emacs.d/plugins/color-theme-molokai.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...

Load-path shadows:

-- 
Wolodja <[email-masked]>

4096R/CAF14EFC
081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC