Subject: 23.1; Crash involving emacsclient -c and multiple $DISPLAYs
From: Nelson Elhage <[email-masked]>
To: [email-masked]
Date: Tue, 09 Nov 2010 10:13:36 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

I have been getting a lot of crashes when I run 'emacs --daemon' and
then connect to it using 'emacsclient -c' with multiple $DISPLAY
values. The crashes usually happen when or shortly after I close a
window started on a different $DISPLAY than the one I started --daemon
in.

I'm sorry I can't be more specific -- the bug happens pretty frequently,
but I haven't been able to produce a completely reliable reproducer. I
managed to catch the crash in gdb, thuogh, so I figured I'd submit the
bug with the backtrace (which looks like it might be informative).

----------------------------------------------------------------------
(gdb) bt full
#0  0x00000000004b4ef6 in x_atom_to_symbol (dpy=0xfff83d0, atom=<value optimized out>) at xselect.c:343
        dpyinfo = <value optimized out>
        str = <value optimized out>
        val = <value optimized out>
#1  0x00000000004b82e2 in x_handle_selection_request (event=0x7fffd6620e10) at xselect.c:908
        local_selection_data = <value optimized out>
        selection_symbol = <value optimized out>
        local_selection_time = <value optimized out>
        successful_p = 11008721
        dpyinfo = 0x0
#2  x_handle_selection_event (event=0x7fffd6620e10) at xselect.c:1097
No locals.
#3  0x00000000004e3177 in swallow_events (do_display=0) at keyboard.c:4425
        copy = {
          kind = SELECTION_REQUEST_EVENT,
          code = 0,
          part = 268403664,
          modifiers = 0,
          x = 10485762,
          y = 448,
          timestamp = 31,
          padding = {0x273, 0x0},
          frame_or_window = 11008721,
          arg = 11008721
        }
        event = <value optimized out>
        old_timers_run = <value optimized out>
#4  0x00000000004e3e36 in read_char (commandflag=<value optimized out>, nmaps=<value optimized out>, maps=<value optimized out>, prev_event=11008721, used_mouse_menu=0x7fffd6621334, end_time=0x0) at keyboard.c:2715
        c = 0
        local_getcjmp = {{
            __jmpbuf = {90432, 5524207, 140736790139024, 140736790139200, 140736790139104, 55604177, 0, 140736790139208},
            __mask_was_saved = 1,
            __saved_mask = {
              __val = {5550371, 1, 5486842, 0, 55604176, 140736790139296, 140736790139200, 140736790139208, 0, 0, 1759403301127331328, 0, 140736790139200, 1, 0, 199567584}
            }
          }}
        save_jump = {{
            __jmpbuf = {238200352, 295314356, 11303, 5869275, 11303, 5870718, 140736790138480, 11304},
            __mask_was_saved = 0,
            __saved_mask = {
              __val = {11380353, 173741221, 295314356, 11302, 5869275, 11302, 5870718, 11058017, 11303, 173741221, 11058017, 173741221, 5873236, 295314356, 140736790139360, 11058017}
            }
          }}
        key_already_recorded = 0
        tem = <value optimized out>
        save = <value optimized out>
        previous_echo_area_message = 11008721
        also_record = 11008721
        reread = 0
        polling_stopped_here = <value optimized out>
        orig_kboard = 0x50a3290
#5  0x00000000004e65b5 in read_key_sequence (keybuf=0x7fffd66213c0, bufsize=<value optimized out>, prompt=<value optimized out>, dont_downcase_last=<value optimized out>, can_return_switch_frame=<value optimized out>, fix_current_buffer=<value optimized out>) at keyboard.c:9460
        interrupted_kboard = 0x50a3290
        key = 0
        used_mouse_menu = 0
        echo_local_start = 0
        last_real_key_start = 0
        keys_local_start = 0
        local_first_binding = 0
        from_string = 11008721
        count = 2
        t = 0
        echo_start = 0
        keys_start = 0
        nmaps = 4
        nmaps_allocated = 4
        defs = 0x7fffd66211e0
        submaps = 0x7fffd6621210
        orig_local_map = 271131429
        orig_keymap = 11008721
        localized_local_map = 0
        first_binding = 0
        first_unbound = 31
        mock_input = 0
        fkey = {
          parent = 84495445,
          map = 84495445,
          start = 0,
          end = 0
        }
        keytran = {
          parent = 11000597,
          map = 11000597,
          start = 0,
          end = 0
        }
        indec = {
          parent = 84496453,
          map = 84496453,
          start = 0,
          end = 0
        }
        shift_translated = 0
        delayed_switch_frame = 11008721
        original_uppercase = 11230113
        original_uppercase_position = -1
        starting_buffer = <value optimized out>
        fake_prefixed_keys = 11008721
#6  0x00000000004e8930 in command_loop_1 () at keyboard.c:1642
        cmd = <value optimized out>
        lose = 3
        nonundocount = 0
        keybuf = {192, 424, 384, 1, 140736790139968, 5677070, 65280, 154353635, 64424509440, 1759403301127331328, 0, 283031221, 11008721, 11008721, 0, 1, 0, 5110890, 4294968251, 140736790140032, 140736790140360, 11863808, 283031221, 5111267, 140736790139648, 8242431743018139648, 8386109761210884207, 11008721, 12596913, 1759403301127331328}
        i = 3
        prev_modiff = 3389741
        prev_buffer = 0x3b98e20
        already_adjusted = 0
#7  0x000000000054a61f in internal_condition_case (bfun=<value optimized out>, handlers=<value optimized out>, hfun=<value optimized out>) at eval.c:1512
        val = 0
        c = {
          tag = 11008721,
          val = 11008721,
          next = 0x7fffd6621680,
          gcpro = 0x0,
          jmp = {{
              __jmpbuf = {11863808, 7356890061868142242, 11863840, 140736790141624, 0, 1, -7356839833704034654, 7356890898227957410},
              __mask_was_saved = 0,
              __saved_mask = {
                __val = {140029677408256, 0, 4294967295, 140736790140320, 1, 8355616, 0, 0, 1, 0, 140029675435985, 1, 0, 1, 140029596026288, 0}
              }
            }},
          backlist = 0x0,
          handlerlist = 0x0,
          lisp_eval_depth = 0,
          pdlcount = 2,
          poll_suppress_count = 1,
          interrupt_input_blocked = 0,
          byte_stack = 0x0
        }
        h = {
          handler = 11095681,
          var = 11008721,
          chosen_clause = 11008817,
          tag = 0x7fffd6621510,
          next = 0x0
        }
#8  0x00000000004df10e in command_loop_2 () at keyboard.c:1359
        val = 0
#9  0x000000000054a74a in internal_catch (tag=<value optimized out>, func=<value optimized out>, arg=<value optimized out>) at eval.c:1248
        c = {
          tag = 11077073,
          val = 11008721,
          next = 0x0,
          gcpro = 0x0,
          jmp = {{
              __jmpbuf = {11863808, 7356890061868142242, 11863840, 140736790141624, 0, 1, -7356839833620148574, 7356890898316562082},
              __mask_was_saved = 0,
              __saved_mask = {
                __val = {0, 0, 0, 0, 144, 32, 432, 80, 11008721, 11429745, 11048784, 11008769, 11421568, 1, 5486842, 11429745}
              }
            }},
          backlist = 0x0,
          handlerlist = 0x0,
          lisp_eval_depth = 0,
          pdlcount = 2,
          poll_suppress_count = 1,
          interrupt_input_blocked = 0,
          byte_stack = 0x0
        }
#10 0x00000000004dfb11 in command_loop () at keyboard.c:1338
No locals.
#11 0x00000000004dff0c in recursive_edit_1 () at keyboard.c:953
        val = <value optimized out>
#12 0x00000000004e0047 in Frecursive_edit () at keyboard.c:1015
        buffer = 11008721
#13 0x00000000004d5aa7 in main (argc=0, argv=0x7fffd6621bf8) at emacs.c:1852
        dummy = 255
        stack_bottom_variable = 0 '\000'
        do_initial_setlocale = <value optimized out>
        skip_args = 1
        rlim = {
          rlim_cur = 8720000,
          rlim_max = 18446744073709551615
        }
        no_loadup = 0
        junk = 0x0
        dname_arg = 0x0
(gdb) xbacktrace 
(gdb) 
----------------------------------------------------------------------

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1/etc/DEBUG for instructions.

In GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2010-03-29 on yellow, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10706000
configured using `configure  '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=lucid' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

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_US.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  global-whitespace-mode: t
  window-number-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t

Recent input:
C-x 3 C-x 3 C-d + C-x + <backspace> M-x r e b u <tab> 
<M-backspace> C-a C-k r e p o r t <tab> e <backspace> 
<return>

Recent messages:
Source file `/home/nelhage/code/notmuch/emacs/notmuch.el' newer than byte-compiled file
Source file `/home/nelhage/code/notmuch/emacs/notmuch-lib.el' newer than byte-compiled file
Source file `/home/nelhage/code/notmuch/emacs/notmuch-show.el' newer than byte-compiled file
Source file `/home/nelhage/code/notmuch/emacs/notmuch-hello.el' newer than byte-compiled file
PGP version set to GPG.
Loading `elscreen': old-style backquotes detected!
Starting Emacs daemon.
Restarting server
if: Cannot bind server socket: address already in use
When done with this frame, type C-x 5 0
call-interactively: End of buffer