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 8369B431FB6 for ; Fri, 28 Jan 2011 18:26:07 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 Vtetzsu4SZCO for ; Fri, 28 Jan 2011 18:26:06 -0800 (PST) Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.216.181]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id B871F431FB5 for ; Fri, 28 Jan 2011 18:26:06 -0800 (PST) Received: by qyk12 with SMTP id 12so4324326qyk.5 for ; Fri, 28 Jan 2011 18:26:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=fgyhyiZFYX3hwQuJe7TwbZ8rAneXDvg/AreyPZw6YNI=; b=wVoKegsLkVFNtK48znWtWIm1fJrpcFAEKIySqXThuNOX8GWsfaEj2ZaJItinLQKwcA z5YX+SAQgULjtoSpNQNjxKqftMUAov0oDY03ezSx/Lyvemr4Uat8B66i9qjoRu4+na1R dYzFv8HB7wPDSZvT6vsYJn6pBzWlWcYfQeXtc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=ByKjviTGQb6BMvp3oEMJGUnY4t19vXN/Lp106Y5BmNCPZDOFhIQMdDJsrJyQtdT9eC /MPDFAaNBzNx4A69tX/dJdqZ1lFDviBzavxCz4N+CNfQsZT4S+TuU1DOpgnQVbIUIS4h pO2CC2vFc5uT8t6A+eXIVZTSNIkyjJ5lMPs+8= MIME-Version: 1.0 Received: by 10.229.90.200 with SMTP id j8mr841274qcm.268.1296267963686; Fri, 28 Jan 2011 18:26:03 -0800 (PST) Sender: amdragon@gmail.com Received: by 10.229.97.143 with HTTP; Fri, 28 Jan 2011 18:26:03 -0800 (PST) In-Reply-To: References: <87d3nhe3g9.fsf@steelpick.2x.cz> Date: Fri, 28 Jan 2011 21:26:03 -0500 X-Google-Sender-Auth: giVW8szFjjpLL7WMKLy9xO4d1lQ Message-ID: Subject: Re: Xapian locking errors with custom query parser From: Austin Clements To: Michal Sojka Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: notmuch@notmuchmail.org 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: Sat, 29 Jan 2011 02:26:07 -0000 Looks like I managed to remove the line that deletes (and thus closes and unlocks) the Xapian::Database object in a bout of overzealous code removal. The consequence was exactly what you suspected; there was a brief window after notmuch had exited before the database actually got unlocked. Here's the fix. cworth, what's the most convenient way for me to slip this in to the patch series? diff --git a/lib/database.cc b/lib/database.cc index 7253bdf..3c488a9 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -826,6 +826,7 @@ notmuch_database_close (notmuch_database_t *notmuch) } delete notmuch->term_gen; + delete notmuch->xapian_db; talloc_free (notmuch); } On Fri, Jan 28, 2011 at 11:35 AM, Austin Clements wrote: > This should most definitely not happen. =A0I'll look in to it. > > On Fri, Jan 28, 2011 at 5:18 AM, Michal Sojka wrote= : >> >> Hi Austin, >> >> when I switched to using your custom query parser I started experiencing >> "Unable to get write lock" errors when I run my initial tagging script. >> I thought that this was because I run the script while processing the >> mail in Emacs, but today I realized that this happens even without Emacs >> and that it can be reproduced by a simple command below. >> >> i=3D0; while notmuch tag +xxx tag:whatever; do i=3D$((i+1)); echo $i; do= ne >> >> It seems that sometimes the unlocking of the Xapian database happens >> somewhat lazily and when the subsequent command starts I get: >> >> A Xapian exception occurred opening database: Unable to get write lock o= n >> /home/wsh/mail/.notmuch/xapian: already locked >> >> This happens almost regularly after a few iterations of the loop even if >> the query doesn't match anything. >> >> Do you have an idea what may cause this? >> >> Can you reproduce this on your system? >> >> The version I use can be obtained from >> >> =A0git://rtime.felk.cvut.cz/notmuch.git custom-query-pasrser >> >> Thanks >> -Michal >> _______________________________________________ >> notmuch mailing list >> notmuch@notmuchmail.org >> http://notmuchmail.org/mailman/listinfo/notmuch > >