From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Crowe Newsgroups: gmane.emacs.bugs Subject: bug#16737: Possible patch Date: Thu, 9 Jul 2015 13:44:15 +0100 Message-ID: <20150709124415.GA10564@mcrowe.com> References: <20150708205413.GB18890@mcrowe.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1436445926 27582 80.91.229.3 (9 Jul 2015 12:45:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Jul 2015 12:45:26 +0000 (UTC) To: 16737@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 09 14:45:15 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 1ZDBCT-0005Nf-GR for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Jul 2015 14:45:13 +0200 Original-Received: from localhost ([::1]:39599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDBCT-0000iv-1k for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Jul 2015 08:45:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDBCN-0000iZ-ND for bug-gnu-emacs@gnu.org; Thu, 09 Jul 2015 08:45:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDBCI-0003gV-V6 for bug-gnu-emacs@gnu.org; Thu, 09 Jul 2015 08:45:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDBCI-0003el-Qo for bug-gnu-emacs@gnu.org; Thu, 09 Jul 2015 08:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZDBCI-0000Dl-5P for bug-gnu-emacs@gnu.org; Thu, 09 Jul 2015 08:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mike Crowe Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Jul 2015 12:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16737 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 16737-submit@debbugs.gnu.org id=B16737.1436445864777 (code B ref 16737); Thu, 09 Jul 2015 12:45:02 +0000 Original-Received: (at 16737) by debbugs.gnu.org; 9 Jul 2015 12:44:24 +0000 Original-Received: from localhost ([127.0.0.1]:44880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZDBBg-0000CS-Ch for submit@debbugs.gnu.org; Thu, 09 Jul 2015 08:44:24 -0400 Original-Received: from smtpout.karoo.kcom.com ([212.50.160.34]:48002) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZDBBe-0000CF-F5 for 16737@debbugs.gnu.org; Thu, 09 Jul 2015 08:44:23 -0400 X-IronPort-AV: E=Sophos;i="5.15,439,1432594800"; d="scan'208";a="63450333" Original-Received: from deneb.mcrowe.com (HELO deneb) ([82.152.148.4]) by smtpout.karoo.kcom.com with ESMTP; 09 Jul 2015 13:44:15 +0100 Original-Received: from mac by deneb with local (Exim 4.84) (envelope-from ) id 1ZDBBX-0002pt-Km for 16737@debbugs.gnu.org; Thu, 09 Jul 2015 13:44:15 +0100 Content-Disposition: inline In-Reply-To: <20150708205413.GB18890@mcrowe.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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:104846 Archived-At: On Wednesday 08 July 2015 at 21:54:13 +0100, Mike Crowe wrote: > Thanks to Alan's reproduction recipe in message #158 I've been able to > do a bit of digging. > > From what I can determine pselect is continuously being woken up due > to activity on the X file descriptor (this can be seen in message #70) > yet pending_signals never gets set so unblock_input_to never calls > process_pending_signals so xgselect just goes round and round until > the timeout time is reached. :( > > I suspected that SIGIO was left being incorrectly blocked but I > haven't been able to find any evidence for that yet. I think that suspicion is correct. The massive paste in the terminal causes keyboard.c:kbd_buffer_store_buffered_event to call ignore_sigio() but the only place I could find that sets the handler for SIGIO is init_keyboard so noone ever re-enables the SIGIO signal handler. :( It appears that keyboard.c:kbd_buffer_get_event used to re-enable the signal handler but that was removed in 4d7e6e51dd4acecff466a28d958c50f34fc130b8. I tried reinstating enabling the signal handler with this patch against master and I can no longer reproduce the problem when following with Alan's recipe. I've no idea whether this is the correct fix though. commit eb28ee70c836cc273dcca4c5c3de1099db2cd4fe Author: Mike Crowe Date: Thu Jul 9 13:32:55 2015 +0100 Fix 16737 diff --git a/src/keyboard.c b/src/keyboard.c index c5a392f..e710d5a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -316,6 +316,8 @@ static Lisp_Object command_loop (void); static void echo_now (void); static ptrdiff_t echo_length (void); +static void deliver_input_available_signal (int sig); + /* Incremented whenever a timer is run. */ unsigned timers_run; @@ -3849,6 +3851,14 @@ kbd_buffer_get_event (KBOARD **kbp, /* Start reading input again because we have processed enough to be able to accept new events again. */ unhold_keyboard_input (); +#ifdef USABLE_SIGIO + if (!noninteractive) + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_input_available_signal); + sigaction (SIGIO, &action, 0); + } +#endif start_polling (); } #endif /* subprocesses */ Mike.