Subject: bug#22174: 24.4; emacs --daemon crashes when ssh is disconnected. I am using lucid x toolkit.

From: Eli Zaretskii <[email-masked]>
Date: Wed, 16 Dec 2015 21:36:32 +0200

[Please keep the bug address on the CC list.]

> Date: Wed, 16 Dec 2015 12:59:49 -0600
> From: Cody Addison <[email-masked]>
> 
> Here is the result. I am including the backtrace of all 3 threads. The SIGTERM
> comes when I Ctrl-C the ssh command. I didn't expect that to pass through to
> the emacs daemon.
> 
> (gdb) continue
> Continuing.
> [New Thread 0x7f789b17d700 (LWP 52670)]
> [New Thread 0x7f789a97c700 (LWP 52765)]
> 
> Program received signal SIGTERM, Terminated.
> [Switching to Thread 0x7f789b17d700 (LWP 52670)]
> 
> backtrace thread 1:
> 
> (gdb) thread 1
> [Switching to thread 1 (Thread 0x7f78a10fa880 (LWP 26190))]
> #0 0x00007f789e045e79 in __pselect (nfds=6, readfds=0x7fff4c537f40,
> writefds=0x7fff4c537fc0, exceptfds=0x0, timeout=<optimized out>,
> sigmask=<optimized out>) at ../sysdeps/unix/sysv/linux/pselect.c:77
> 77 ../sysdeps/unix/sysv/linux/pselect.c: No such file or directory.
> (gdb) backtrace
> #0 0x00007f789e045e79 in __pselect (nfds=6, readfds=0x7fff4c537f40,
> writefds=0x7fff4c537fc0, exceptfds=0x0, timeout=<optimized out>,
> sigmask=<optimized out>) at ../sysdeps/unix/sysv/linux/pselect.c:77
> #1 0x000000000065505b in xg_select (fds_lim=6, rfds=0x7fff4c538550,
> wfds=0x7fff4c5385d0, efds=0x0, timeout=0x7fff4c538530, sigmask=0x0)
> at ../../emacs-24.4/src/xgselect.c:105
> #2 0x000000000061b0c7 in wait_reading_process_output (time_limit=0, nsecs=0,
> read_kbd=-1, do_display=true, wait_for_cell=12752882, wait_proc=0x0,
> just_wait_proc=0) at ../../emacs-24.4/src/process.c:4606
> #3 0x000000000053c869 in kbd_buffer_get_event (kbp=0x7fff4c5388b8,
> used_mouse_menu=0x7fff4c538de9, end_time=0x0)
> at ../../emacs-24.4/src/keyboard.c:3906
> #4 0x00000000005390da in read_event_from_main_queue (end_time=0x0,
> local_getcjmp=0x7fff4c538bf0, used_mouse_menu=0x7fff4c538de9)
> at ../../emacs-24.4/src/keyboard.c:2246
> #5 0x000000000053933e in read_decoded_event_from_main_queue (end_time=0x0,
> local_getcjmp=0x7fff4c538bf0, prev_event=12752882,
> used_mouse_menu=0x7fff4c538de9) at ../../emacs-24.4/src/keyboard.c:2309
> #6 0x000000000053a835 in read_char (commandflag=1, map=36984518,
> prev_event=12752882, used_mouse_menu=0x7fff4c538de9, end_time=0x0)
> at ../../emacs-24.4/src/keyboard.c:2895
> #7 0x0000000000546170 in read_key_sequence (keybuf=0x7fff4c538fd0,
> bufsize=30, prompt=12752882, dont_downcase_last=false,
> can_return_switch_frame=true, fix_current_buffer=true,
> prevent_redisplay=false) at ../../emacs-24.4/src/keyboard.c:9088
> #8 0x00000000005375c1 in command_loop_1 ()
> at ../../emacs-24.4/src/keyboard.c:1452
> #9 0x00000000005c970b in internal_condition_case (
> bfun=0x5371f9 <command_loop_1>, handlers=12804482,
> hfun=0x536ae8 <cmd_error>) at ../../emacs-24.4/src/eval.c:1348
> #10 0x0000000000536f53 in command_loop_2 (ignore=12752882)
> at ../../emacs-24.4/src/keyboard.c:1177
> #11 0x00000000005c8f1d in internal_catch (tag=12800418,
> func=0x536f2d <command_loop_2>, arg=12752882)
> at ../../emacs-24.4/src/eval.c:1112
> #12 0x0000000000536f01 in command_loop ()
> at ../../emacs-24.4/src/keyboard.c:1156
> #13 0x00000000005366e3 in recursive_edit_1 ()
> at ../../emacs-24.4/src/keyboard.c:777
> #14 0x0000000000536850 in Frecursive_edit ()
> at ../../emacs-24.4/src/keyboard.c:848
> #15 0x0000000000534867 in main (argc=2, argv=0x7fff4c5393d8)
> at ../../emacs-24.4/src/emacs.c:1646
> 
> backtrace thread 2:
> 
> (gdb) thread 2
> [Switching to thread 2 (Thread 0x7f789c1a5700 (LWP 26191))]
> #0 0x00007f789e04112d in poll () at ../sysdeps/unix/syscall-template.S:81
> 81 ../sysdeps/unix/syscall-template.S: No such file or directory.
> (gdb) backtrace
> #0 0x00007f789e04112d in poll () at ../sysdeps/unix/syscall-template.S:81
> #1 0x00007f789e57ffe4 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #2 0x00007f789e5800ec in g_main_context_iteration ()
> from /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #3 0x00007f789e580129 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #4 0x00007f789e5a4f05 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #5 0x00007f789e321182 in start_thread (arg=0x7f789c1a5700)
> at pthread_create.c:312
> #6 0x00007f789e04e47d in clone ()
> at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
> 
> backtrace thread 3:
> 
> 0x00007f789e32920b in raise (sig=15)
> at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
> 37 ../nptl/sysdeps/unix/sysv/linux/pt-raise.c: No such file or directory.
> (gdb) backtrace
> #0 0x00007f789e32920b in raise (sig=15)
> at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
> #1 0x00007f789ced5adc in ffi_call_unix64 ()
> from /usr/lib/x86_64-linux-gnu/libffi.so.6
> #2 0x00007f789ced540c in ffi_call ()
> from /usr/lib/x86_64-linux-gnu/libffi.so.6
> #3 0x00007f789e850055 in g_cclosure_marshal_generic_va ()
> from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
> #4 0x00007f789e84f5e7 in ?? ()
> from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
> #5 0x00007f789e868088 in g_signal_emit_valist ()
> from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
> #6 0x00007f789e868ce2 in g_signal_emit ()
> from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
> #7 0x00007f789eb539d5 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
> #8 0x00007f789e57fce5 in g_main_context_dispatch ()
> from /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #9 0x00007f789e580048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #10 0x00007f789e5800ec in g_main_context_iteration ()
> from /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #11 0x00007f789b1851ad in ?? ()
> from /usr/lib/x86_64-linux-gnu/gio/modules/libdconfsettings.so
> #12 0x00007f789e5a4f05 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #13 0x00007f789e321182 in start_thread (arg=0x7f789b17d700)
> at pthread_create.c:312
> #14 0x00007f789e04e47d in clone ()
> at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Looks like thread 3, which runs some Glib code, deliberately killed
the entire process by raising SIGTERM.