Red Hat Bugzilla – Bug 860312
emacs chews CPU, spams .xsession-errors with "Back to top level."
Last modified: 2015-02-17 09:28:18 EST
Since I updated my 100+ desktops to F17, I've been having problems with user volumes filling up with huge .xsession-errors files containing little other than "Back to top level." repeated endlessly. I tracked this down to emacs processes, and further came upon debbugs.gnu.org/cgi/bugreport.cgi?bug=10669/ which appears to cover the same issue.
It doesn't seem like many people see this, but for some reason my users are hitting it several times per day. I myself have been unable to reproduce it, but then I've spent most of my time cleaning up after this problem rather than trying to understand what's causing it. I just wanted to get it on the record here to see if anyone else has hints on figuring out what's happening and why my users are all seeing it when few others are.
Just happened again to one of my users. Here's the contents of .xsession-errors from startup until the process was killed (excluding millions of repetitions of "Back to top level."
Warning: due to a long standing Gtk+ bug
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
("/usr/bin/emacs" "--no-splash" "--smid=101d421af6133000134850254500000199660029")
krunner(4716) KDevelopSessions::KDevelopSessions: INIT KDEV
krunner(4716) KDevelopSessions::loadSessions: LOADSESSION!.>>>
Loading /usr/share/emacs/site-lisp/site-start.d/auctex.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/auctex.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/desktop-entry-mode-init.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/desktop-entry-mode-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/focus-init.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/focus-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/php-mode-init.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/php-mode-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/preview-latex.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/preview-latex.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/rpm-spec-mode-init.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/rpm-spec-mode-init.el (source)...done
Starting Emacs daemon.
Back to top level.
Back to top level.
[continued millions of times]
Back to top level.
Error: server did not start correctly
[emacs process was killed here]
This seems to be related to emacs being started at login by the session manager. Everyone uses KDE here so I can't speak for what other environments do. Here's the relevant bit:
At login that will chew CPU and spew to .xsession-errors mercilessly until killed. What's worse is that it doesn't actually run, so the user starts another one, and on the next login you get two of them doing the same thing.
Just happened to me again -- note that I never use emacs deliberately, so it's somehow starting automatically without me requesting it. Possibly a MIME type/file association thing.
Aha -- figured out a bit more: in the KDE File Associations module, the top file association for files of "text/x-tex" is "Emacs Client". And I did download a .tex file from the web recently, which must have put emacs into my session.
So for me at least, the short-term fix will be to change the file associations for text/x-tex. But the underlying problem with emacs-client starting automatically seems to remain. :(
Just had this happen for a few of my users as well - we are using XFCE desktop and it seems a few applications are set to open with XEmacs Text Editor by default so I'm guessing that is the cause of the problem. Ideally the emacs package would be updated tho....
Just discovered I have 567 *gigabytes* of "Back to top level." messages in .xsession-errors, constantly being generated at a rate of 150kB/sec... whaa??
I'm running xfce on a fresh install of F18, and emacs is run in daemon mode in the session by default for some reason. The emacs daemon shouldn't be run by default, unless it is requested. And it shouldn't be dumping this message in the log, obviously, but just removing the code that dumps this line in the log won't solve the problem, one CPU core is pegged at 100%, so whatever is causing emacs to spin needs to be fixed.
N.B. for anybody running into this, the heavy-handed "killall -9 emacs ; rm ~/.xsession-errors" doesn't free the disk space until you log out and log back in, because tons of other running processes also have the .xsession-errors open. You need to do something like "echo > ~/.xsession-errors" to empty the logfile instead.
See also https://groups.google.com/forum/#!topic/gnu.emacs.bug/uiEqe710M4U
There's a comment on the bottom of the following page about this bug:
The suggested fix is:
"Workaround: Start emacs with “emacs --daemon -q”. The first time you connect via emacsclient, open your .emacs file and run ‘eval-buffer’."
After trying that fix, I get the following emacs crash on session login: Bug 875440
Fortunately, now that the emacs daemon crashes on session login, it no longer dumps error messages into .xsession-errors!
I haven't found what is actually starting the emacs daemon yet, so I can stop the daemon from starting -- the xfce session manager doesn't show it as being started on session start, and the process parent is systemd, but systemd doesn't seem to have a service file for emacs in the location /etc/systemd/system/emacs@.service , recommended on this page:
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.
(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)
More information and reason for this action is here:
This message is a notice that Fedora 19 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 19. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 19 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
Thank you for reporting this bug and we are sorry it could not be fixed.