Bug 860312 - emacs chews CPU, spams .xsession-errors with "Back to top level."
emacs chews CPU, spams .xsession-errors with "Back to top level."
Product: Fedora
Classification: Fedora
Component: emacs (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Petr Hracek
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-09-25 10:41 EDT by Jason Tibbitts
Modified: 2015-02-17 09:28 EST (History)
13 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-02-17 09:28:18 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jason Tibbitts 2012-09-25 10:41:30 EDT
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.
Comment 1 Jason Tibbitts 2012-09-25 11:50:18 EDT
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]
Comment 2 Jason Tibbitts 2012-10-04 10:35:35 EDT
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.
Comment 3 Mary Ellen Foster 2012-11-07 05:03:09 EST
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.
Comment 4 Mary Ellen Foster 2012-11-07 05:09:05 EST
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. :(
Comment 5 Josh Trutwin 2012-11-08 09:48:12 EST
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....
Comment 6 Luke Hutchison 2013-01-05 04:03:04 EST
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.
Comment 7 Luke Hutchison 2013-01-05 04:12:10 EST
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.
Comment 8 Luke Hutchison 2013-01-05 04:38:42 EST
See also https://groups.google.com/forum/#!topic/gnu.emacs.bug/uiEqe710M4U
Comment 9 Luke Hutchison 2013-01-05 05:06:35 EST
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: 

Comment 10 Fedora Admin XMLRPC Client 2013-02-27 10:47:44 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 11 Fedora End Of Life 2013-04-03 13:01:37 EDT
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:
Comment 12 Fedora End Of Life 2015-01-09 12:23:01 EST
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.
Comment 13 Fedora End Of Life 2015-02-17 09:28:18 EST
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.

Note You need to log in before you can comment on or make changes to this bug.