unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noah Friedman <friedman@splode.com>
To: 19494@debbugs.gnu.org
Subject: bug#19494: 25.0.50; infinite loop in readable_event on master branch
Date: Fri, 02 Jan 2015 19:18:03 -0800 (PST)	[thread overview]
Message-ID: <20150102191803.251212.FMU1084@unexploded-cow.prv.splode.com> (raw)

Ever since commit 614beeecf29d16c08f66a4f82b6085be90df8a74 (c. Nov 01 2014)
I keep finding "idle" emacs processes running in a tight loop in
keyboard.c:readable_event after I come back to my session the following
morning.  In those cases, kbd_buffer is full of the same event, in my case:

        $17 = {
          kind = BUFFER_SWITCH_EVENT,
          part = scroll_bar_nowhere,
          code = 0,
          modifiers = 0,
          x = 0,
          y = 0,
          timestamp = 0,
          frame_or_window = 12962290,
          arg = 12962290
        }

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.

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.
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.





             reply	other threads:[~2015-01-03  3:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-03  3:18 Noah Friedman [this message]
2015-01-03  8:17 ` bug#19494: 25.0.50; infinite loop in readable_event on master branch Eli Zaretskii
2015-01-07 21:08   ` Noah Friedman
2021-07-13 18:06     ` Lars Ingebrigtsen
2021-07-20  8:47       ` Noah Friedman
2021-08-19 13:21         ` Lars Ingebrigtsen
2021-08-27 20:38           ` Noah Friedman
2021-08-28 15:07             ` Lars Ingebrigtsen

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=20150102191803.251212.FMU1084@unexploded-cow.prv.splode.com \
    --to=friedman@splode.com \
    --cc=19494@debbugs.gnu.org \
    --cc=noah@splode.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).