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 D2AD0429E21 for ; Sun, 6 Nov 2011 17:32:40 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-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 G4TAe7ih-rnY for ; Sun, 6 Nov 2011 17:32:38 -0800 (PST) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id DBC29431FB6 for ; Sun, 6 Nov 2011 17:32:37 -0800 (PST) Received: by faan15 with SMTP id n15so1880807faa.26 for ; Sun, 06 Nov 2011 17:32:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=98oL6ZKi19CQguYSOZr2eVJzQoMDqQ3GgRxCeNoZNu8=; b=IYEBEbd+4BuElxDBehD8k7dCBUpsvryTg2pZf6gdCIx3h/Q/ZkB/kQW9hkJiJGaf/L euAFWcfMV7R3DFMoTWYEdj6IzhMsLFVTGpp3hS3RLmVx/kd0GeO+UsLyYUB/lhx9Sb1r TMK+SLyMvUAxjFJTTk+ayy9HN/0fTnX6XAyE0= Received: by 10.152.105.67 with SMTP id gk3mr5550423lab.48.1320629555036; Sun, 06 Nov 2011 17:32:35 -0800 (PST) Received: from localhost ([88.251.184.245]) by mx.google.com with ESMTPS id hm12sm7069097lab.9.2011.11.06.17.32.32 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Nov 2011 17:32:33 -0800 (PST) Date: Mon, 7 Nov 2011 03:32:29 +0200 From: Ali Polatel To: David Riebenbauer Subject: Re: [PATCH 0/3] notmuch-deliver: wait for database to become unlocked and test Message-ID: <20111107013229.GA27262@hayalet> Mail-Followup-To: David Riebenbauer , Notmuch Mailing List References: <1320578584-6642-1-git-send-email-davrieb@liegesta.at> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RnlQjJ0d97Da+TV1" Content-Disposition: inline In-Reply-To: <1320578584-6642-1-git-send-email-davrieb@liegesta.at> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Notmuch Mailing List 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: Mon, 07 Nov 2011 01:32:41 -0000 --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 06, 2011 at 12:23:01PM +0100, David Riebenbauer wrote: >Hi, > >I noticed that mail would bounce in my setup, if the xapian database >was locked while notmuch-deliver tried to run. I recall having this problem sometime ago... >My solution was to make it wait for some time adn retry. A test >program for is alos included. Looks like a workaround more than a solution. What happens if the database doesn't become available for writing in the meantime? Quoting from: http://xapian.org/docs/admin_notes.html#single-writer-multiple-reader "Xapian enforces this restriction using by having a writer lock the databas= e. Each Xapian database directory contains a lock file named flintlock (we've = kept the same name as flint used, since the locking technique is the same). This lock-file will always exist, but will be locked using fcntl() when the database is open for writing. Because of the semantics of fcntl() locking, = for each WritableDatabase opened we spawn a child process to hold the lock, whi= ch then exec-s cat, so you will see a cat subprocess of any writer process in = the output of ps, top, etc." See? It's a simple fcntl() lock! That said, I'm against adding this kind of kludge to notmuch-deliver or any other tool accessing the database via libnotmuch. Until the issue is fixed properly I, and I suppose you, can live with a simple shell script using flock(1) on the file .notmuch/xapian/flintlock. One possible solution is described by Austin in the mail: id:AANLkTi=3DKOx8aTJipkiArFVjEHE6zt_JypoASMiiAWBZ6@mail.gmail.com which I quite like. >Regards, >David -alip >David Riebenbauer (3): > notmuch-deliver: wait for the database to become unlocked > notmuch-deliver: test wait for database to become available > notmuch-deliver: Convert test program to glib main loop. > > contrib/notmuch-deliver/.gitignore | 2 + > contrib/notmuch-deliver/Makefile.am | 2 +- > contrib/notmuch-deliver/configure.ac | 1 + > contrib/notmuch-deliver/src/main.c | 25 +++- > contrib/notmuch-deliver/test/Makefile.am | 26 +++ > contrib/notmuch-deliver/test/nm-test.sh | 9 + > contrib/notmuch-deliver/test/nm-testconfig | 12 ++ > contrib/notmuch-deliver/test/notmuch-lock.c | 226 ++++++++++++++++++++++= +++++ > contrib/notmuch-deliver/test/testmail | 7 + > 9 files changed, 306 insertions(+), 4 deletions(-) > create mode 100644 contrib/notmuch-deliver/test/Makefile.am > create mode 100755 contrib/notmuch-deliver/test/nm-test.sh > create mode 100644 contrib/notmuch-deliver/test/nm-testconfig > create mode 100644 contrib/notmuch-deliver/test/notmuch-lock.c > create mode 100644 contrib/notmuch-deliver/test/testmail > >--=20 >1.7.7.1 > >_______________________________________________ >notmuch mailing list >notmuch@notmuchmail.org >http://notmuchmail.org/mailman/listinfo/notmuch --RnlQjJ0d97Da+TV1 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAk63NS0ACgkQQU4yORhF8iCkLACeO3fFLjS7k+/3aAqwpsWQE52a W3wAn1Pn/AtpZUwsTLE22Bm5T4gSphYL =VYgh -----END PGP SIGNATURE----- --RnlQjJ0d97Da+TV1--