emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Matt Price <moptop99@gmail.com>
Cc: help-gnu-emacs@gnu.org, nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: diagnosing emacs hangs
Date: Tue, 22 Jun 2010 10:23:29 -0400	[thread overview]
Message-ID: <4061.1277216609@gamaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Matt Price <moptop99@gmail.com> of "Mon, 21 Jun 2010 21:18:15 EDT." <AANLkTimza_Fv80ho01bsrbQSobtz3qZEod6jhaGssloo@mail.gmail.com>

Matt Price <moptop99@gmail.com> wrote:


> I'm now using emacs for almost everything and of course that's great,
> except that it is essentially a single-threaded OS that currently
> HANGS with some frequency (100% CPU usgte that will continue for hours
> if you let it go.  I think this probably has something to do with
> wanderlust or possibly org-mode (and/or misconfigurations i've made to
> both of these); but at present i cna't be sure since i have no idea
> how to diagnose these hangs.  Can someone give me some general
> directions on how to proceed with the diagnosis, and if you have them,
> some pointers on how you fixed a similar problem that you used to
> have?  Right now it's very frustrating -- I find myself losing
> substantial amounts of work when I kill emacs & maybe more
> importantly, i'm constantly losing my train of thought.
> 
> This is all under Ubuntu Lucid with emacs-snapshot 20090909,
> wanderlust=wl-beta 2.15.9+0.20100303, org-mode 6.34c (some of htese
> are debian sid packages).
> 

I assume only emacs is stuck, so you can open an xterm: what does ``ps
awlx | grep emacs'' say?  In particular, the state and the wchan are of
interest: normally, it should be in S state and waiting on select: idle
and waiting for input. If it's persistently in D state, it's stuck
somewhere in the kernel - the wchan gives an idea where. Do it a few times
to make sure that things are not changing.

The next step is to do ``strace -p<emacs_pid>'' to see whether it's going
in and out of the kernel (perhaps in an infinite loop).

If it is *not* going into the kernel, but accumulates CPU runtime (check
the ps awlx output a few times), then it's stuck in a loop in user
space. Attaching to it with ``gdb -p<emacs_pid>'' and getting a
backtrace should give an idea of where it's stuck. But if the loop is in
lisp code, the backtrace is not going to tell you where: it'll just be
in eval. If that's the case, then bisecting through your .emacs setup is
probably the best idea (maybe start by commenting out the org/wanderlust
stuff, particularly if you started getting these problems recently,
after making changes to their configuration.)

It's always a good idea to do these things with a working emacs first, so
that you learn what "normal" looks like. Then you have a better idea
of what's wrong when you try them on the stuck emacs.

This only scratches the surface but...

HTH,
Nick

      parent reply	other threads:[~2010-06-22 14:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-22  1:18 diagnosing emacs hangs Matt Price
2010-06-22  2:44 ` Qiang Guo
2010-06-22  6:04 ` Ian Barton
2010-06-22 10:05 ` Tassilo Horn
2010-06-22 14:23 ` Nick Dokos [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4061.1277216609@gamaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    --cc=moptop99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).