unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dani Moncayo <dmoncayo@gmail.com>
Cc: 14333@debbugs.gnu.org
Subject: bug#14333: 24.3.50; Emacs hangs when trying to exit
Date: Thu, 09 May 2013 18:53:04 +0300	[thread overview]
Message-ID: <83obckcfq7.fsf@gnu.org> (raw)
In-Reply-To: <CAH8Pv0gKD-Fwi3AVfkMg9kX6m5SAOpwWjQFsBMagGZ+tVYa8LQ@mail.gmail.com>

> Date: Thu, 9 May 2013 11:09:11 +0200
> From: Dani Moncayo <dmoncayo@gmail.com>
> Cc: 14333@debbugs.gnu.org
> 
> So, it seems it is not possible to attach gdb to the hanged Emacs
> session.   Is there another way of tracking down the problem?

I hope so.  See below.

> For example, I could add some sentences at the C level, which write
> information to some log file.  If this is a good idea, just send me
> the patch I should apply.

I don't know yet what to write and where.  We need more information
about the problem.

I can think about 2 methods to gain more info:

 1) Attach GDB before you exit Emacs, while Emacs still runs.
    Hopefully, it will attach cleanly.  Then:

     (gdb) break shut_down_emacs
     (gdb) continue

    Now exit Emacs as usual.  GDB will kick in and stop Emacs inside
    shut_down_emacs.  Step through that function (with "next") and see
    which call doesn't return.  Then try the same again in another
    session, but now step into the function that didn't return, and
    step through that, again looking for some sub-function that
    doesn't return.  Etc., etc., until you find which system call
    doesn't return, or maybe some Emacs code that infloops for some
    reason.

 2) Download and install the latest version of Process Explorer from
    SysInternals.

    Start Process Explorer and find the line showing the running Emacs
    (before you exit it).  Right-click on that line, and select
    "Properties".  In the window that pops up, click on the "Threads"
    tab.  You should see several threads that belong to Emacs.

    Now exit Emacs.  Every thread that exits should have its line
    highlighted by a red background.  Normally, they all exit, so they
    all become red.  I suspect that in your case, some of them will
    not exit.  If so, click on the line of that thread, and tell what
    is its State as shown below the thread list.

    Next, click the entry of the thread that didn't exit, and push the
    "Stack" button below the thread list.  This should pop up another
    window with the call stack addresses.  Press "Copy All" and then
    paste into some file.  Repeat this for every thread that did not
    exit.

    Now start GDB on the Emacs binary:

       gdb emacs.exe

    and translate the call stack addresses into source lines like
    this:

      (gdb) list *0xNNNNNNN

    where NNNNNNN is the address you see in the call stack after
    "emacs+", to which you need to add 0x1000000.  For example, if you
    see emacs+0x19f93, type

      (gdb) list *0x1019f93

    This should show a small number of source lines around the line
    that corresponds to the address.  The top-most address of the form
    emacs+0xNNNN that you find in the call stack of each thread that
    didn't exit is the most important one -- it tells where that
    thread is stuck.

    Alternatively, you can use addr2line to convert addresses to
    source line numbers; once again, you will need to add 0x1000000 to
    each address displayed by the Process Explorer.

I hope at least one of these 2 methods will allow us to determine why
Emacs hangs.





  reply	other threads:[~2013-05-09 15:53 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02  7:09 bug#14333: 24.3.50; Emacs hangs when trying to exit Dani Moncayo
2013-05-02 16:20 ` Eli Zaretskii
2013-05-08  7:51   ` Dani Moncayo
2013-05-08 16:43     ` Eli Zaretskii
2013-05-09  6:32       ` Dani Moncayo
2013-05-09  9:09         ` Dani Moncayo
2013-05-09 15:53           ` Eli Zaretskii [this message]
2013-05-15 16:47             ` Dani Moncayo
2013-05-15 17:18               ` Eli Zaretskii
2013-05-15 19:11                 ` Dani Moncayo
2013-05-15 20:42                   ` Eli Zaretskii
2013-05-16  7:10                     ` Eli Zaretskii
2013-05-16  7:18                       ` Dani Moncayo
2013-05-16  7:35                         ` Eli Zaretskii
2013-05-16  7:44                           ` Dani Moncayo
2013-05-16  8:59                             ` Eli Zaretskii
2013-05-21  7:01                               ` Dani Moncayo
2013-05-21 16:48                                 ` Eli Zaretskii
2013-05-22 17:50                                   ` Dani Moncayo
2013-08-29  7:22                                     ` Dani Moncayo
2013-08-29 15:33                                       ` Eli Zaretskii
2013-08-30  6:30                                         ` Dani Moncayo
2013-08-30  7:15                                           ` Eli Zaretskii
2013-09-11  8:44                                         ` Dani Moncayo
2013-09-11 13:38                                           ` Eli Zaretskii
2013-09-11 14:20                                             ` Dani Moncayo
2013-09-11 16:22                                               ` Eli Zaretskii
2013-10-02 16:12                                                 ` Dani Moncayo
2013-11-13 16:40                                                   ` Dani Moncayo
2013-11-13 16:50                                                     ` Eli Zaretskii
2013-11-13 17:00                                                       ` Dani Moncayo
2013-11-13 20:28                                                         ` Eli Zaretskii
2013-11-13 20:50                                                           ` Dani Moncayo
2013-11-13 21:01                                                             ` Eli Zaretskii
     [not found]                                                               ` <CAH8Pv0iRiQj+ZDnQr_0+obmsYPf_+mzn-m4ECMqG4K7Wi_G1xQ@mail.gmail.com>
2013-11-13 21:15                                                                 ` Dani Moncayo
2013-11-13 21:20                                                                 ` Eli Zaretskii
2013-11-19 17:13                                                               ` Dani Moncayo
2013-11-19 17:36                                                                 ` Eli Zaretskii
2013-11-19 17:42                                                                   ` Eli Zaretskii
2013-11-21 17:10                                                                     ` Dani Moncayo
2013-11-21 17:28                                                                       ` Eli Zaretskii
2014-06-30 16:33 ` Dani Moncayo
2014-07-10 11:44   ` Dani Moncayo
2014-07-10 15:08     ` Eli Zaretskii
2014-07-10 15:13       ` Dani Moncayo
2014-07-10 17:45         ` Eli Zaretskii
2014-07-10 19:24           ` Dani Moncayo
2014-07-10 19:26             ` Eli Zaretskii
2014-07-14 10:15               ` Dani Moncayo
2014-07-14 14:46                 ` Eli Zaretskii
2014-07-21 12:35                   ` Dani Moncayo
2014-07-21 14:37                     ` Eli Zaretskii
2014-07-22  6:39                       ` Dani Moncayo
2014-07-25  8:17                         ` Eli Zaretskii
2014-09-02 13:18                           ` Dani Moncayo
2014-09-04 15:35                             ` Eli Zaretskii
2014-09-04 19:37                               ` Dani Moncayo
2014-09-12  6:14                                 ` Dani Moncayo
2014-09-12  8:11                                   ` Eli Zaretskii
2014-09-12  8:20                                     ` Dani Moncayo
2015-12-26  0:45                                       ` Lars Ingebrigtsen

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83obckcfq7.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=14333@debbugs.gnu.org \
    --cc=dmoncayo@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.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).