From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#19494: 25.0.50; infinite loop in readable_event on master branch Date: Sat, 03 Jan 2015 10:17:44 +0200 Message-ID: <83oaqg9t1z.fsf@gnu.org> References: <20150102191803.251212.FMU1084@unexploded-cow.prv.splode.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1420273097 31376 80.91.229.3 (3 Jan 2015 08:18:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Jan 2015 08:18:17 +0000 (UTC) Cc: 19494@debbugs.gnu.org To: Noah Friedman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 03 09:18:10 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y7JuT-0006vJ-UN for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Jan 2015 09:18:10 +0100 Original-Received: from localhost ([::1]:53724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y7JuT-0004gj-8O for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Jan 2015 03:18:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y7JuQ-0004gd-5y for bug-gnu-emacs@gnu.org; Sat, 03 Jan 2015 03:18:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y7JuM-0001In-VP for bug-gnu-emacs@gnu.org; Sat, 03 Jan 2015 03:18:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y7JuM-0001IT-RU for bug-gnu-emacs@gnu.org; Sat, 03 Jan 2015 03:18:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Y7JuM-0002Yx-EK for bug-gnu-emacs@gnu.org; Sat, 03 Jan 2015 03:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Jan 2015 08:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19494 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19494-submit@debbugs.gnu.org id=B19494.14202730709833 (code B ref 19494); Sat, 03 Jan 2015 08:18:02 +0000 Original-Received: (at 19494) by debbugs.gnu.org; 3 Jan 2015 08:17:50 +0000 Original-Received: from localhost ([127.0.0.1]:35377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y7JuA-0002YX-Bi for submit@debbugs.gnu.org; Sat, 03 Jan 2015 03:17:50 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:57762) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y7Ju7-0002YN-8H for 19494@debbugs.gnu.org; Sat, 03 Jan 2015 03:17:48 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NHL00800CTWUB00@a-mtaout20.012.net.il> for 19494@debbugs.gnu.org; Sat, 03 Jan 2015 10:17:45 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NHL008AJDPKLV60@a-mtaout20.012.net.il>; Sat, 03 Jan 2015 10:17:45 +0200 (IST) In-reply-to: <20150102191803.251212.FMU1084@unexploded-cow.prv.splode.com> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:97956 Archived-At: > Cc: eliz@gnu.org > From: Noah Friedman > Date: Fri, 02 Jan 2015 19:18:03 -0800 (PST) > > That is, the entire kbd_buffer queue is BUFFER_SWITCH_EVENT events. > Because of that, it means the sequence > > do { > .... > if (event == kbd_buffer + KBD_BUFFER_SIZE) > event = kbd_buffer; > } > while (event != kbd_store_ptr); > > in the function readable_event will, at least at times, loop forever. It's strange no one reported anything similar since that changeset was pushed. > I don't have a trivial or always-reliable test case but I think the > offending elisp is the following, running in a (non-idle) timer: > > (force-mode-line-update 'all) > (sit-for 0) ; force redisplay > > I can change the elisp in question since I wrote it, but I'm not sure what > the right way to do it is since it's not just running during idle times. Why do you need that code, and in a timer on top of that? It looks strangely, and probably papers over some bug, either one that existed in the past or maybe even an existing one. If that bug still exists, a bug report will be appreciated. > In any case having emacs lock up in a non-recoverable way seems like a bug, > since the only way out is to hit C-g and abort, or else go in with gdb > on the running process and force a return. > > Maybe this loop needs some kind of "didn't find any other event" flag to > avoid looping, but I thought I'd check with the original committer first in > case he has a better idea. Stefan is in a better position to answer that, as my keyboard-event foo is not strong enough. You will see in the archives that I asked him whether we should ignore these events before writing the patch. One thing is clear: having input-pending-p return non-nil when there's nothing in the queue but these buffer-switch events is a real bug that causes quite a few problems. So going back is not an option, I think. I do agree it would be nice to remove the possibility of looping, even if it is a remote one. And the logic you suggest is exactly what I had in mind reading your description, so no, I don't have any better idea. Maybe Stefan does.