Subject: bug#15025: emacs --daemon stuck in infinite loop

From: Dan Nicolaescu <[email-masked]>
Date: Fri, 09 Aug 2013 09:25:19 -0400

martin rudalics <[email-masked]> writes:

>>> next_frame has that loop "while (passed < 2)" where emacs gets stuck,
>>> but prev_frame does not.  Any idea what can it make it get stuck there?
>>
>> Hm... strange values (dead frame?) in Vframe_list may be a reason.
>
> IIUC failing to increment passed can happen only if the frame next_frame
> got called with is not on Vframe_list.  We could try asserting that it is.

That gives the idea of killing multiple emacsclients at the same time...

This looks reproducible:

Xnest :1
xterm -display :1
in that xterm:
emacs -Q --deamon

from the :0 display create 2 more xterms in Xnest:
xterm -display :1
xterm -display :1

and in each of the do 
emacsclient -t 
C-z

in another xterm on :0 do:
emacsclient -t 
C-z

at this point we should have 3 suspended emacsclients, 2 in Xnest, one
in the main display.

Kill Xnest

Now emacs is stuck. VframeList looks like it's empty.