Subject: Re: bug#12832: 24.3.50; Emacs lockup when idle

From: Eli Zaretskii <[email-masked]>
Date: Tue, 13 Nov 2012 17:16:38 +0200

> Date: Tue, 13 Nov 2012 14:25:30 +0000
> From: Andy Moreton <[email-masked]>
> CC: Dani Moncayo <[email-masked]>, [email-masked], 
>  [email-masked]
> 
> Correct - I've done a clean bootstrap using 4.7.0, and I see this problem on 
> both trunk and emacs-24 branches.
> 
> Looking emacs-24 (r110863) with Process Explorer:
> 
> 212412   emacs.exe+0x32291              State:  Wait:DelayExecution
> 212616   emacs.exe+0x148efe             State:  Wait:Suspended
> 212604   emacs.exe+0x142350             State:  Wait:WrUserRequest
> 236140   RPCRT4.dll!ThreadStartRoutine  State:  Wait:WrQueue
> 
> I tried suspending and then resuming each thread in turn from Process 
> Explorer. Resuming thread 212604 unblocked emacs and it started working again.

Was that the only thread whose resumption unlocks Emacs?  If so, can
you find out what thread was that?  Process Explorer can show that
call-stack, and you should be able to find out what functions were
referenced by using the "info line" command inside GDB.  Like this:

  (gdb) info line *0x11c3d40
  Line 863 of "sysdep.c" starts at address 0x11c3d40 <init_sys_modes+7>
     and ends at 0x11c3d4a <init_sys_modes+17>.

(Note the asterisk before the address.)

WrUserRequest seems to indicate that the thread was suspended by the
application itself, which would point the blaming finger at my
implementation of SIGALRM (see w32proc.c), whereby when the timer
expires, the thread which runs the timer code suspends the main
thread, invokes the signal handler, and then resumes the main thread.
If my guess is correct, this would mean that the thread whose state is
WrUserRequest is the main (a.k.a. "Lisp") thread.

Another possibility is that this is the input thread, the one that
calls GetMessage.  But then I don't understand why it is blocked
forever until manually resumed.  Hmm...

If you attach GDB, do you again see garbled backtrace, like in the
original report?  Or do you see something more informative?