Subject: bug#16479: 24.3.50; daemon freeze with tty menus

From: Mark Oteiza <[email-masked]>
Date: Fri, 17 Jan 2014 04:39:55 -0500

>From emacs --daemon -Q:

$ emacsclient -t
M-x menu-bar-mode RET <F10>

At this point, the daemon is started, and a client is open with a tty
menu selected.  Leaving the first client alone, open a new one

$ emacsclient -t

Now emacs is frozen.  Here is the tail of a strace attached to the
daemon, which I helped crash by closing one of the clients.

04:10:03 open("/usr/share/emacs/24.3.50/lisp/obsolete/term/screen-256color.gz", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
04:10:03 open("/usr/share/emacs/24.3.50/lisp/term/screen.elc", O_RDONLY|O_CLOEXEC) = 15
04:10:03 fstat(15, {st_mode=S_IFREG|0644, st_size=616, ...}) = 0
04:10:03 close(15)                      = 0
04:10:03 stat("/home/mvo", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
04:10:03 write(14, "\33[H\33[J", 6)     = 6
04:10:03 --- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
04:10:03 rt_sigreturn()                 = 6
04:10:03 ioctl(14, FIONREAD, [0])       = 0
04:10:03 ioctl(7, FIONREAD, [0])        = 0
04:10:03 write(14, "\33[25;1H\33[?25lWhen done with this"..., 75) = 75
04:10:03 --- SIGIO {si_signo=SIGIO, si_code=SI_TKILL, si_pid=18845, si_uid=1000} ---
04:10:03 rt_sigreturn()                 = 4611686018528051200
04:10:03 ioctl(14, FIONREAD, [0])       = 0
04:10:03 ioctl(7, FIONREAD, [0])        = 0
04:10:03 ioctl(14, FIONREAD, [0])       = 0
04:10:03 ioctl(7, FIONREAD, [0])        = 0
04:10:03 pselect6(15, [4 5 6 7 8 13 14], [], NULL, {100000, 0}, {NULL, 8}) = 1 (in [14], left {99996, 327603809})
04:10:06 ioctl(14, FIONREAD, [15746688]) = -1 EIO (Input/output error)
04:10:06 write(14, "\33[25;1H\33[K", 10) = -1 EIO (Input/output error)
04:10:06 write(14, "\33[?1l\33>\33[34h\33[?25h\33[?1049l\33[39;4"..., 35) = -1 EIO (Input/output error)
04:10:06 fdatasync(14)                  = -1 EINVAL (Invalid argument)
04:10:06 fcntl(14, F_SETFL, O_RDWR|O_LARGEFILE) = 0
04:10:06 fcntl(14, F_SETOWN, 0)         = 0
04:10:06 fcntl(14, F_GETFL)             = 0x8002 (flags O_RDWR|O_LARGEFILE)
04:10:06 fcntl(14, F_SETFL, O_RDWR|O_LARGEFILE) = 0
04:10:06 ioctl(14, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B38400 opost isig icanon echo ...}) = -1 EIO (Input/output error)
04:10:06 close(14)                      = 0
04:10:06 ioctl(7, FIONREAD, [0])        = 0
04:10:06 pselect6(14, [4 5 6 7 8 13], [], NULL, {100000, 0}, {NULL, 8}) = 1 (in [13], left {99999, 999991184})
04:10:06 read(13, "", 4096)             = 0
04:10:06 close(13)                      = 0
04:10:06 pselect6(14, [5 6 7], NULL, NULL, {0, 0}, {NULL, 8}) = 0 (Timeout)
04:10:06 ioctl(7, FIONREAD, [0])        = 0
04:10:06 pselect6(14, [4 5 6 7 8], [], NULL, {100000, 0}, {NULL, 8}) = 1 (in [7], left {99997, 207503468})
04:10:09 --- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
04:10:09 rt_sigreturn()                 = 1
04:10:09 ioctl(7, FIONREAD, [1])        = 0
04:10:09 read(7, "\16", 1)              = 1
04:10:09 ioctl(7, FIONREAD, [0])        = 0
04:10:09 ioctl(7, FIONREAD, [0])        = 0
04:10:09 rt_sigaction(SIGABRT, {SIG_DFL, [ABRT], SA_RESTORER|SA_RESTART, 0x7f24323773e0}, {0x4f3300, ~[KILL STOP RTMIN RT_1], SA_RESTORER, 0x7f24326fb870}, 8) = 0
04:10:09 getpgrp()                      = 18845
04:10:09 ioctl(0, TIOCGPGRP, [32548])   = -1 ENOTTY (Inappropriate ioctl for device)
04:10:09 close(6)                       = 0
04:10:09 close(5)                       = 0
04:10:09 open("/home/mvo/.emacs.d/auto-save-list/.saves-18845-holos.localdomain~", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 5
04:10:09 fcntl(5, F_GETFL)              = 0x8001 (flags O_WRONLY|O_LARGEFILE)
04:10:09 fstat(5, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
04:10:09 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f24291d7000
04:10:09 lseek(5, 0, SEEK_CUR)          = 0
04:10:09 close(5)                       = 0
04:10:09 munmap(0x7f24291d7000, 4096)   = 0
04:10:09 rt_sigprocmask(SIG_BLOCK, [WINCH IO], NULL, 8) = 0
04:10:09 rt_sigaction(SIGIO, {SIG_IGN, [IO], SA_RESTORER|SA_RESTART, 0x7f24323773e0}, {0x4dd260, [INT QUIT ALRM CHLD PROF WINCH IO], SA_RESTORER, 0x7f24326fb870}, 8) = 0
04:10:09 futex(0x7f24326ea1b0, FUTEX_WAKE_PRIVATE, 2147483647) = 0
04:10:09 futex(0x7f242fa123f0, FUTEX_WAKE_PRIVATE, 2147483647) = 0
04:10:09 write(2, "\nBacktrace:\n", 12) = 12
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"4f41eb", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"4dae5e", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"4f4243", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"4a47ef", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"4a5b15", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"4a87e8", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"460a3c", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"54b6fb", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"57f63d", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"54b1af", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"54b51b", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"57f63d", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"54b1af", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"54b51b", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"54cb87", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"5476a3", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"54b6eb", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"57f63d", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"54b51b", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"54b84a", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"4e902d", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"549b4e", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"4db2ee", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"549a5b", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"4df867", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"4dfb52", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"413c55", 6}, {"]\n", 2}], 4) = 16
04:10:09 writev(2, [{"/usr/lib/libc.so.6", 18}, {"(", 1}, {"__libc_start_main", 17}, {"+0x", 3}, {"f5", 2}, {")", 1}, {"[0x", 3}, {"7f2432363b05", 12}, {"]\n", 2}], 9) = 59
04:10:09 writev(2, [{"emacs", 5}, {"[0x", 3}, {"414713", 6}, {"]\n", 2}], 4) = 16
04:10:09 rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
04:10:09 tgkill(18845, 18845, SIGABRT)  = 0
04:10:09 --- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=18845, si_uid=1000} ---
04:10:09 +++ killed by SIGABRT +++

In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
 of 2014-01-17 on holos
Repository revision: 
Configured using:
 `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=lucid --with-xft
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector
 --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  show-paren-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC x r e p o TAB r t TAB RET

Recent messages:
("emacs")
Starting Emacs daemon.
Loading term/xterm...done
When done with this frame, type C-x 5 0
Making completion list...
delete-backward-char: Text is read-only [4 times]

Load-path shadows:
/usr/share/emacs/site-lisp/timeclock hides /usr/share/emacs/24.3.50/lisp/calendar/timeclock

Features:
(shadow sort gnus-util mail-extr emacsbug message idna format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils help-mode easymenu xterm server
windmove edmacro kmacro cl-loaddefs cl-lib time-date paren zenburn-theme
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting x-toolkit x multi-tty emacs)