Re: Race condition for '*' command
authorCarl Worth <cworth@cworth.org>
Tue, 28 Jun 2011 19:48:26 +0000 (12:48 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:47 +0000 (09:38 -0800)
84/893a575fee279c53043e102f8a4c27615543c3 [new file with mode: 0644]

diff --git a/84/893a575fee279c53043e102f8a4c27615543c3 b/84/893a575fee279c53043e102f8a4c27615543c3
new file mode 100644 (file)
index 0000000..1042274
--- /dev/null
@@ -0,0 +1,142 @@
+Return-Path: <cworth@cworth.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 88D7E429E2A\r
+       for <notmuch@notmuchmail.org>; Tue, 28 Jun 2011 12:48:40 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.01\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.01 tagged_above=-999 required=5\r
+       tests=[T_MIME_NO_TEXT=0.01] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id ZQqj4hYbjlUB for <notmuch@notmuchmail.org>;\r
+       Tue, 28 Jun 2011 12:48:40 -0700 (PDT)\r
+Received: from arlo.cworth.org (arlo.cworth.org [50.43.72.2])\r
+       by olra.theworths.org (Postfix) with ESMTP id D17B7429E25\r
+       for <notmuch@notmuchmail.org>; Tue, 28 Jun 2011 12:48:39 -0700 (PDT)\r
+Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
+       by arlo.cworth.org (Postfix) with ESMTP id AB2AF29A820;\r
+       Tue, 28 Jun 2011 12:48:38 -0700 (PDT)\r
+Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
+       id 9D8112541A8; Tue, 28 Jun 2011 12:48:38 -0700 (PDT)\r
+From: Carl Worth <cworth@cworth.org>\r
+To: Mark Anderson <ma.skies@gmail.com>, Pieter Praet <pieter@praet.org>,\r
+       Robin Green <greenrd@greenrd.org>, notmuch@notmuchmail.org\r
+Subject: Re: Race condition for '*' command\r
+In-Reply-To: <87tyb9j1th.fsf@gmail.com>\r
+References: <86d3i1d06r.fsf@dragonfly.greenrd.org>\r
+       <87sjqx31mp.fsf@servo.factory.finestructure.net>\r
+       <86aad5c6h2.fsf@dragonfly.greenrd.org>\r
+       <87fwmuxxgd.fsf@praet.org> <87tyb9j1th.fsf@gmail.com>\r
+User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1\r
+       (i486-pc-linux-gnu)\r
+Date: Tue, 28 Jun 2011 12:48:26 -0700\r
+Message-ID: <8739itagad.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 28 Jun 2011 19:48:40 -0000\r
+\r
+--=-=-=\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Tue, 28 Jun 2011 11:36:10 -0600, Mark Anderson <ma.skies@gmail.com> wrot=\r
+e:\r
+> On Tue, 28 Jun 2011 08:49:06 +0200, Pieter Praet <pieter@praet.org> wrote:\r
+> > On Sun, 26 Jun 2011 10:00:41 +0100, Robin Green <greenrd@greenrd.org> w=\r
+rote:\r
+> > > On Sat, 25 Jun 2011 16:57:50 -0700, Jameson Graef Rollins <jrollins@f=\r
+inestructure.net> wrote:\r
+> > > > On Sat, 25 Jun 2011 23:18:52 +0100, Robin Green <greenrd@greenrd.or=\r
+g> wrote:\r
+> > > > > A race condition in the '*' command was noted when it was first\r
+> > > > > proposed. It looks to me like it still exists - has anything been=\r
+ done\r
+> > > > > about it?\r
+\r
+Not much. I did add this note to notmuch/TODO at the time:\r
+\r
+       Fix '*' to work by simply calling '+' or '-' on a region\r
+       consisting of the entire buffer\r
+\r
+> > Could be solved by doing it with `notmuch-search', `mark-whole-buffer'\r
+> > and `notmuch-search-{add,remove}-tag-region' instead, but I'm sure\r
+> > there's a better way (of which I'm as of yet unaware).\r
+\r
+That's a more concrete description of the same idea.\r
+\r
+I did some experiments at one point and determined that doing this would\r
+make '*' far too painful to be usable with large search-result buffers,\r
+(which is precisely when I am most likely to use it).\r
+\r
+But even if we were willing to accept the performance penalty, (or if we\r
+fixed notmuch-search-*-tag-region to accumulate the thread IDs and make\r
+a single invocation of notmuch to avoid the performance penalty). Even\r
+then, there would still be race conditions here, (though more subtle\r
+than the current race).\r
+\r
+At that point we would only be acting on threads that matched the\r
+original search, but we could be acting on more messages than were\r
+originally presented to the user.\r
+\r
+For example, a thread might have been displayed as having only one post,\r
+but the "* -inbox" operation would remove the inbox tag from any replies\r
+received in the interim.\r
+\r
+I'd love to find some clean solutions here, as I would love notmuch to\r
+offer an interface that is free of these race conditions, (which are\r
+scary since they can prevent a user from seeing some mail).\r
+\r
+Personally, I'm avoiding all races right now by only running "notmuch\r
+new" manually, (and not otherwise interacting with notmuch while\r
+"notmuch new" is running). This does avoid the races, but is fairly\r
+awkward, (I have to manually run this (or use the annoyingly blocking\r
+'G'[*] binding), so I would prefer the ability to have new mail\r
+incorporated automatically as it arrives.\r
+\r
+Independent of this particular race condition, having something like\r
+fetchmail automatically invoke "notmuch new" also has the potential to\r
+break your mail client with Xapian Database-modified exceptions.\r
+\r
+So we do need some more direct support for this mode of operation.\r
+\r
+In the meantime, I've at least updated the TODO note a bit:\r
+\r
+       Fix '*' to work by simply calling '+' or '-' on a region\r
+       consisting of the entire buffer, (this would avoid one race\r
+       condition---while still leaving other race conditions---but\r
+       could also potentially make '*' a very expensive operation).\r
+\r
+=2DCarl\r
+\r
+[*] notmuch-search-poll-and-refresh-view\r
+\r
+=2D-=20\r
+carl.d.worth@intel.com\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.11 (GNU/Linux)\r
+\r
+iEYEARECAAYFAk4KMAoACgkQ6JDdNq8qSWjIwACffAcWjBu1RNxBmvMUz9iyPMX2\r
+M9QAoJ0FRDH1SGqm4cV+IP6irRze/s0n\r
+=BO27\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r