unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman@gmail.com>
To: Andy Moreton <andrewjmoreton@gmail.com>
Cc: fni@missioncriticalit.com, 12832@debbugs.gnu.org
Subject: bug#12832: 24.3.50; Emacs lockup when idle
Date: Wed, 14 Nov 2012 17:48:41 +0100	[thread overview]
Message-ID: <CANbX366v=KGeV+dq2eeSTOs-+gozK2j1oj2Fb9N+c=eZvQP5=Q@mail.gmail.com> (raw)
In-Reply-To: <50A3C701.4090308@gmail.com>

I have no time to build Emacs now and have not had it for a very long
time. However I have seen Emacs freeze a lot of times when it is idle.
This started to get more common when I moved to a 64-bit windows 7
(from windows xp, 32-bit).

I have always thought that this must be bad handling of the messages
from the operating systems, but I have had no chance to pin this down.
Reading here I wonder if data are accessed somewhere in a system time
thread without critical section handling.

On Wed, Nov 14, 2012 at 5:29 PM, Andy Moreton <andrewjmoreton@gmail.com> wrote:
> On 14/11/2012 12:44, Andy Moreton wrote:
>>
>> On 13/11/2012 17:04, Eli Zaretskii wrote:
>>>
>>> Can you please try the patch below and see if it prevents the
>>> lock-ups?
>>>
>>> === modified file 'src/w32proc.c'
>>> --- src/w32proc.c       2012-11-05 03:18:32 +0000
>>> +++ src/w32proc.c       2012-11-13 16:59:53 +0000
>>> @@ -431,13 +431,24 @@ timer_loop (LPVOID arg)
>>>           /* Simulate a signal delivered to the thread which installed
>>>              the timer, by suspending that thread while the handler
>>>              runs.  */
>>> -         DWORD result = SuspendThread (itimer->caller_thread);
>>> +         DWORD result;
>>> +
>>> +         if (dwMainThreadId)
>>> +           enter_crit ();
>>> +         result = SuspendThread (itimer->caller_thread);
>>>
>>>           if (result == (DWORD)-1)
>>> -           return 2;
>>> +           {
>>> +             if (dwMainThreadId)
>>> +               leave_crit ();
>>> +             return 2;
>>> +           }
>>>
>>>           handler (sig);
>>>           ResumeThread (itimer->caller_thread);
>>> +
>>> +         if (dwMainThreadId)
>>> +           leave_crit ();
>>>         }
>>>
>>>         /* Update expiration time and loop.  */
>>>
>>
>> I applied this to emacs-24 branch (r110866) this morning. So far I've not
>> seen
>> a lockup, but I'll to run it for a day or two to be sure.
>
>
> After longer uptime, it seems this patch is not successful. I haven't had a
> complete lockup, but I have seen a couple of glitches where it froze but
> then recovered a short while later.
>
> The unfreeze may have been due to capturing a stack trace with Process
> Explorer (I have upgraded to the latest version which is less buggy).
>
> The patched emacs-24 does seem to leak handles: at the moment Process
> Explorer report that emacs has 50805 handles in all, most of which are
> thread handles. The number of handles seems to increase at a rate of 2 to 4
> per second.
>
>     AndyM
>
>
>
>
>
>
>





  reply	other threads:[~2012-11-14 16:48 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08 12:57 bug#12832: 24.3.50; Emacs lockup when idle Andy Moreton
2012-11-08 16:28 ` Eli Zaretskii
2012-11-08 18:33   ` Andy Moreton
2012-11-09  9:56     ` Eli Zaretskii
2012-11-09 10:48       ` Andy Moreton
2012-11-09 11:14         ` Eli Zaretskii
2012-11-09 18:11           ` Eli Zaretskii
2012-11-09 18:38             ` Andy Moreton
2012-11-09 19:12               ` Eli Zaretskii
2012-11-09 19:15                 ` Eli Zaretskii
2012-11-13 12:59               ` Eli Zaretskii
     [not found]                 ` <509BAC2E.2000702-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-11-13 13:13                   ` Fabrice Niessen
2012-11-13 13:39                     ` Dani Moncayo
2012-11-13 14:07                       ` Eli Zaretskii
2012-11-13 14:25                         ` Andy Moreton
2012-11-13 15:16                           ` Eli Zaretskii
2012-11-13 16:00                             ` Andy Moreton
2012-11-13 16:35                               ` Eli Zaretskii
2012-11-13 16:40                                 ` Andy Moreton
2012-11-13 17:20                                   ` Eli Zaretskii
2012-11-13 17:04                               ` Eli Zaretskii
2012-11-14 12:44                                 ` Andy Moreton
2012-11-14 16:29                                   ` Andy Moreton
2012-11-14 16:48                                     ` Lennart Borgman [this message]
2012-11-14 17:41                                       ` Eli Zaretskii
2012-11-14 17:49                                         ` Lennart Borgman
2012-11-14 17:53                                           ` Eli Zaretskii
2012-11-14 16:51                                     ` Eli Zaretskii
2012-11-14 20:17                                       ` Andy Moreton
2012-11-15 19:26                                         ` Andy Moreton
2012-11-15 20:22                                           ` Eli Zaretskii

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='CANbX366v=KGeV+dq2eeSTOs-+gozK2j1oj2Fb9N+c=eZvQP5=Q@mail.gmail.com' \
    --to=lennart.borgman@gmail.com \
    --cc=12832@debbugs.gnu.org \
    --cc=andrewjmoreton@gmail.com \
    --cc=fni@missioncriticalit.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).