Subject: bug#4064: 23.1; Hang up from tty mode when X server goes away

From: Dan Nicolaescu <[email-masked]>
Date: Thu, 6 Aug 2009 23:29:56 -0700 (PDT)

"Dickon Reed (dreed)" <[email-masked]> writes:

  > I am running my own build of emacs 23.1.1 on CentOS 4.4. I start emacs
  > under screen and run server-start from my init file. I then login via
  > ssh (PuTTy) from an Windows XP box, connect to the screen session, and
  > use make-frame-on-display to open a frame on a Cygwin/X version 1.5.3
  > (20090222) X server running on my desktop Windows XP box. So far,
  > everything works fine. After a few hours work, I hibernate my Windows
  > box, and then log in via ssh from a different site. I find the emacs
  > running screen unresponsive, whereas I'd have liked the emacs
  > session under screen to be working.
  > 
  > Later, I woke up the Windows box, logged back into the screen session
  > and found it had recently reported that it had lost the connection to
  > the X server (see log below). At that point, I can only a frame again
  > and everything is back to normal.

I don't have a way to reproduce your setup, but there's an easy
workaround to this problem: instead of starting emacs in a screen
session, use:
emacs --daemon
it will start it in background.

Then you can use
emacsclient -t
to connect to it on a terminal
or
emacsclient -c
to create X11 frames.

  > 
  > 
  > In GNU Emacs 23.1.1 (i686-pc-linux-gnu, X toolkit)
  >  of 2009-07-30 on runbench-dev.uk.level5networks.com
  > configured using `configure  '--with-gif=no''
  > 
  > 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.UTF-8
  >   value of $XMODIFIERS: nil
  >   locale-coding-system: utf-8-unix
  >   default-enable-multibyte-characters: t
  > 
  > Major mode: Emacs-Lisp
  > 
  > Minor modes in effect:
  >   diff-auto-refine-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
  >   transient-mark-mode: t
  > 
  > Recent input:
  > e SPC t h e SPC r e s u l t s SPC s t o r e SPC w a 
  > s SPC b r o k e n " <backspace> <backspace> <backspace> 
  > <backspace> <backspace> <backspace> <backspace> <backspace> 
  > <backspace> <backspace> <backspace> c <backspace> c 
  > a l l b a c k s SPC a n d <backspace> <backspace> <backspace> 
  > o r SPC f i l e s SPC a r e SPC n o t SPC w o r k i 
  > n g " <return> h g SPC q p o p <return> h g SPC q <backspace> 
  > p u l l SPC - u <return> h g SPC q p u s h SPC - a 
  > <return> h g SPC q a p <return> q <backspace> h g SPC 
  > q f i n SPC - a <return> h g SPC q a d d <backspace> 
  > <backspace> <backspace> <backspace> <backspace> <backspace> 
  > <backspace> <backspace> <backspace> h g SPC q p a <backspace> 
  > <backspace> a p SPC - s <return> h g SPC q p o p SPC 
  > - a <return> h g SPC q p u s h SPC - a <return> h g 
  > SPC <backspace> <backspace> <backspace> <backspace> 
  > <backspace> h g SPC t i p <return> h g SPC p u s h 
  > <return> <switch-frame> C-x n <switch-frame> ESC [ 
  > 1 5 ~ ESC O A ESC O B ESC O B C-x C-f ~ / . e m a c 
  > s RET C-x o C-x 0 C-s f 7 C-s ESC O A ESC O B ESC O 
  > B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC 
  > O A C-s d r C-x o ESC x r e p o r t - e m TAB RET
  > 
  > Recent messages:
  > Wrote /local/dr/runbench/nagbench.py
  > Mark saved where search started [3 times]
  > Saving file /local/dr/runbench/nagbench.py...
  > Wrote /local/dr/runbench/nagbench.py
  > (No files need saving)
  > Compilation finished
  > Quit
  > call-interactively: Text is read-only [4 times]
  > Connection lost to X server `dr-desktop:0.0'
  > Mark saved where search started [2 times]