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 D7078429E29 for ; Sun, 26 Jun 2011 13:27:40 -0700 (PDT) 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 AsuzmZ2LkTR4 for ; Sun, 26 Jun 2011 13:27:40 -0700 (PDT) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 02E43431FD0 for ; Sun, 26 Jun 2011 13:27:39 -0700 (PDT) Received: by wwj40 with SMTP id 40so3347665wwj.2 for ; Sun, 26 Jun 2011 13:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:date:from:to:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=TuIxnP7OhrCKWGVETIHy8Ml2Nn52KQWYnTeVY+eZhwI=; b=FtZNJH3ajVEosYlvRAItnxtPwXtNI6CyGQkjRS8nmVGBvu2qFkHxddOJWqj2ZyZVsx 1ijOhFv0sa6XliDwA/1XRQdg4Ijf8GwQ/4JopR97qwL1pZuksvbDJYHHgODZHfQMilb6 Sp+iNOEH1486MUSs/t7FNUeBxpPJW+LSISj8Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=lQOhlZWQT99ANPLta8NMr8AJjYVWhXjlUdtRtWfJYAwHg7Nk+bADkHSuoSd4UBVcfu 1BCQw5JNSkzQN+BokNPFSQRBiuSJnZbOPS1lGgMGthp6N1qN3VrN5VIFxx4bo4JT461n QNKcZHxR/ZHVJl+Mmh9WzfntxG2OlB4HcMsJg= Received: by 10.216.229.202 with SMTP id h52mr1116764weq.17.1309120058628; Sun, 26 Jun 2011 13:27:38 -0700 (PDT) Received: from brick (cpc1-sgyl2-0-0-cust47.sgyl.cable.virginmedia.com [80.192.18.48]) by mx.google.com with ESMTPS id w58sm2437878weq.1.2011.06.26.13.27.36 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 26 Jun 2011 13:27:37 -0700 (PDT) Date: Sun, 26 Jun 2011 21:27:33 +0100 From: Patrick Totzke To: notmuch@notmuchmail.org Subject: xapian exceptions not caught in python bindings? Message-ID: <20110626202733.GA26837@brick> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J2SCkAp4GZ/dPZZf" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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: Sun, 26 Jun 2011 20:27:41 -0000 --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi all! It's me again, with some strange python behaviour :/ When I iterate over threads or messages only partially, then make changes to the index and continue the iteration, then I don't necessarily get NotmuchError's but the underlying libnotmuch seems to call terminate. I get the following two lines on stderr: terminate called after throwing an instance of 'Xapian::DatabaseModifiedE= rror' Aborted then python aborts without an exception. This happens on current master with current python bindings. To reproduce use this to iterate over messages: ------------------%<------------------- #it_read.py =66rom notmuch import Query,Database msgs =3D Database().create_query('*').search_messages() i=3D0 for m in msgs: i=3Di+1 if i%50=3D=3D0: raw_input() readit =3D str(m) ------------------>%------------------- start it, then use this to change the index: ------------------%<------------------- #it_write.py=20 =66rom notmuch import Query,Database db =3D Database(mode =3D Database.MODE.READ_WRITE) msgs =3D Query(db,'*').search_messages() i=3D0 for m in msgs: i=3Di+1 if i%20=3D=3D0: m.add_tag('REMOVEME') ------------------>%------------------- you have to alternate a bit between hitting enter in the read code and rerunning the write code. Read will fail at some point. The strange thing is that its not consistent: I stumbled upon this while reading a list of threads from notmuch.threads on demand. If reading from the iterator catches a NotmuchError, i create a new= one and update my list threads read so far. This does work, but: on every NotmuchError, I get this on stderr: A Xapian exception occurred performing query: The revision being read has = been discarded - you should call Xapian::Database::reopen() and retry the o= peration Query string was: thread:0000000000001876 After a couple of resets this does not happen again but the next time i read =66rom an outdated index, the whole UI terminates with the "Aborted" message stated above. To sum up, I think there are two bad things happening here: 1) should libnotmuch really print to stderr? 2) the python bindings are either not relaying all exceptions or libnotmuch= is not relaying=20 all xapian exceptions in order for the bindings to intercept them cheers, /p --J2SCkAp4GZ/dPZZf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk4HljUACgkQlDQDZ9fWxaofPQCgtmDfXZrDJv9ZIaUL6XSfrtVZ s08An3rOlZhZWclne70YhAnCl0X4A3J+ =bV3f -----END PGP SIGNATURE----- --J2SCkAp4GZ/dPZZf--