bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12832: 24.3.50; Emacs lockup when idle


From: Andy Moreton
Subject: bug#12832: 24.3.50; Emacs lockup when idle
Date: Wed, 14 Nov 2012 16:29:53 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121026 Thunderbird/16.0.2

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 via email to

[Prev in Thread] Current Thread [Next in Thread]