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