I'm using emacs 26.1 (although I don't think this is a new issue with this verison).
Note - this is not the GTK bug which results in the daemon crashing if X Connectivity is lost. I am aware of that bug and the workaround (specify lucid, motif or no toolkit at compile time rather than GTK).
The GTK issue happens every time you close down an emacsclient session - either gracefully or because of connectivity loss.
My issue is that the daemon will still crash when you exit the ssh session from which the emacsclient session started. Which somewhat defeats the object of having a daemon.
So you can start ssh -X [email protected]
(or however you connect), you can then use emacsclient -c -n
, and kill and recreate emacsclient sessions as many times as you like (this would die on GTK).
But as soon as you kill the parent ssh session, the logout process typically freezes, and when you kill it with ^C
or similar the daemon crashes.
At first I thought this was an issue with either the terminal emulator (mintty) or the X Server I was using (ming, or cygwin's own). However I have now observed this behaviour on native Kubuntu 17.10, so it's nothing to do with Windows.
The issue is annoyingly sporadic - it doesn't happen every time I exit ssh - but it's fairly common.
I can find reference to what I think is the same issue here, in rson's comment. The answer given doesn't help - there should be no need to run --daemon
inside a tmux session. If you execute standard emacs inside a tmux and use M-x server-start
, just to labour the point, then emacs hangs after disconnecting any ssh session where an X emacsclient has been started from.
Finally note that this is specifically an X-Window issue. If I start a daemon, and connect to it using emacsclient -nw
switch I can connect and disconnect the parent ssh session as many times as I want in terminal mode.
This is basically forcing me to remain in terminal mode for all my work, as having a reliable daemon is more important than the nice stuff I miss from having a proper windowing system. I'm hoping someone else has seen this or can offer any advice on diagnosing further - it's driving me crazy :-)
emacsclient -t -q file.txt 2>/dev/null
, it automatically launched daemon if there not any working on the background. In order to do that add following into.bashrc
:export ALTERNATE_EDITOR=""; export EDITOR=emacsclient