From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#53432: [PATCH] Avoid losing keyboard input when inotify is too busy Date: Sat, 22 Jan 2022 08:45:03 +0200 Message-ID: <838rv8nua8.fsf@gnu.org> References: <25067.17249.604070.872185@chiark.greenend.org.uk> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28995"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 53432@debbugs.gnu.org To: Ian Jackson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 22 07:47:42 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nBABZ-0007IB-BQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Jan 2022 07:47:41 +0100 Original-Received: from localhost ([::1]:33124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBABX-0000PG-NQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Jan 2022 01:47:39 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBAA4-0000Lz-CP for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 01:46:09 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42732) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBA9y-0002eh-Gt for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 01:46:08 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nBA9y-0007xS-Bm for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 01:46: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, 22 Jan 2022 06:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53432 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 53432-submit@debbugs.gnu.org id=B53432.164283393730554 (code B ref 53432); Sat, 22 Jan 2022 06:46:02 +0000 Original-Received: (at 53432) by debbugs.gnu.org; 22 Jan 2022 06:45:37 +0000 Original-Received: from localhost ([127.0.0.1]:35635 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBA9Z-0007wj-4F for submit@debbugs.gnu.org; Sat, 22 Jan 2022 01:45:37 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:34334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBA9X-0007wW-BX for 53432@debbugs.gnu.org; Sat, 22 Jan 2022 01:45:35 -0500 Original-Received: from [2001:470:142:3::e] (port=46450 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBA9Q-0002Rf-IU; Sat, 22 Jan 2022 01:45:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=5mH4fNwYWJe04VepCrIYTRIjGqScqMNUFVWS/GqzKGs=; b=QhX0IcFm6nCB SzkhCQZTeI3CirFUqmHCAarETozTt3+pxwLuUHyG6ez0mmZSoM81f9nTi53Nv0J6plvGPGrMo9H82 toBeHQg8Q6uZ+cDeC8idD5F4LvZQArTHroauX4AUpqlAm5wr7eQZ3tSVerq/Pl2QOc7oZBkDHXegw Pxx7AzvBIXRPgREYXceLeB5TOcbV+wQBU+pOfLmRr0MB4gU0EmquXm+6gqPDGkMWNJ6+nljPcSsN0 09oEMepQq3hLWyFhZxEKjaUr7cmdEhiyTci5akvM61YCXRyp8g4isvLAHwhsKQug12Ob2yWewl0IE MOfADbmP77tig/8AV5IS9A==; Original-Received: from [87.69.77.57] (port=1417 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBA9L-0000tZ-HC; Sat, 22 Jan 2022 01:45:25 -0500 In-Reply-To: <25067.17249.604070.872185@chiark.greenend.org.uk> (message from Ian Jackson on Fri, 21 Jan 2022 23:36:01 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:224803 Archived-At: > From: Ian Jackson > Date: Fri, 21 Jan 2022 23:36:01 +0000 > > I experienced a bug where my Emacs (Debian's emacs-lucid) would lose > keystrokes under pathological conditions. I tracked this down to the > keyboard input buffer filling up with inotify events. > > The attached patches have been rebased onto emacs-28 (fbc9b121e062) > and I have tested before-and-after versions in parallel to verify that > the bug appears in the upstream branch and has been fixed with my > patches. > > The bug was really quite severe in my (rather abusive) situation, with > Debian's emacs-lucid 26.1. With the upstream emacs-28 branch it > requires more effort, and loses fewer keys. I suspect that some more > sophisticated approach to inotify requests means it's harder to get > the buffer to fill up with the newer version. Unfortunately I am not > able to share my whole repro, but a key part is to visit the output > file from this > while yes | dd of=t bs=1 count=1000000; do : ; > with global-auto-revert-mode enabled. > > With my patches it is still possible to get emacs to perform very > poorly by abusing it this way, but at least all the keys arrive > eventually. I added some FIXMEs for further work that would be good, > but is not critical to fixing the bug. Thanks. I doubt that we want to complicate our input handling this way on behalf of "abusing" inotify. File notifications are known not to be scalable enough to support global-auto-revert-mode well. In any case, installing this on the emacs-28 branch is out of the question: it's too late for that. We may install some variant of this on master, after discussing how best to handle this. Po Lu's suggestion to stop processing inotify events sounds better to me. > I hope the commit messages are in the expected format. I think I > probably have GNU copyright paperwork on file already, perhaps under a > different email address. I don't see your name or email address on file, so maybe they are both different?