From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id A3sXAs2h+F6AJwAA0tVLHw (envelope-from ) for ; Sun, 28 Jun 2020 13:57:33 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4KYNOcyh+F4gPgAAbx9fmQ (envelope-from ) for ; Sun, 28 Jun 2020 13:57:32 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 86527940415 for ; Sun, 28 Jun 2020 13:57:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 5554C6DE0F28; Sun, 28 Jun 2020 06:57:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6JisGSQQ1wPK; Sun, 28 Jun 2020 06:57:27 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 576076DE0F31; Sun, 28 Jun 2020 06:57:24 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 016E86DE0F31 for ; Sun, 28 Jun 2020 06:57:23 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r7zZh2WW0DE9 for ; Sun, 28 Jun 2020 06:57:21 -0700 (PDT) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by arlo.cworth.org (Postfix) with ESMTPS id DD6866DE0F28 for ; Sun, 28 Jun 2020 06:57:20 -0700 (PDT) Received: by mail-ej1-f44.google.com with SMTP id mb16so14005673ejb.4 for ; Sun, 28 Jun 2020 06:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:mime-version; bh=tt4b6TIdH266HXuf0jzY2VV2royR6NcLhD0XcXUJLlY=; b=su3ANYXXQvtiNl8hsqchKUeqHwkRpsWAqS3jzfgpkIh9o2+l0hlY8WvBktrf32fB1K H5CM3xsC2toFiYKCS0NX9UIQYbzmDHP23SG/JeiB6J+5sohPg6FenRIGszYPyMz5ArkS QCao8THEvjM6WCz3r4Iwrjp2viW/Pr3/5ileOCiu9gpSW1PZ1IfPJQoy3ao1Xq8+6Ucn JvAyVzOdt9/73UmBtn+ydGMAuI0mCmim1jeutOJBQ4xCmriQh/InSG0ptI+aJl7oyhW2 n1BXaMU4TOC/STAli7cVLk74uzRvJuS9QIbOT9mpL3diK5jCTgKeLeg6Wy6bRZZ0alGf wL+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version; bh=tt4b6TIdH266HXuf0jzY2VV2royR6NcLhD0XcXUJLlY=; b=VOe62WJyI51KzJvGiN5i7/owyhBsnI+GJnrjeHjCecFTGayfhhxO0yodJB5GxucDLy MQVMiJbZ4K1f9CkLyAguLdnWwrdH2yu5b4Ghj3h8NC7IE2rDGt4u4Z4q7IRDl8EREd9J lDIHm3wNSHoIt1x7bO2PcUV1VVaFFUjecnugCjgxFssFDmAbH9cjMziSy6qJ2jtZssxx hZ1oRFCIl/aYXfL8fbCdPSZklxaTf0nwYVIs3ssOf6MordMuPrmTxS3L6HaQMU7rf8d1 MLYXjVYcI5kec2o1/3h/0B0ssua67nfk8pjzaiGbzEkbLP3/r0ySOZWZvvk0YMTxmIH/ M2ww== X-Gm-Message-State: AOAM5307YwfaLtGX8afwO/sFA9wzQ2Mc7fPZdxFasd3E6exHh43YJ7kT 6T85dAWAjTV2TJk7xaTONa8fefNm X-Google-Smtp-Source: ABdhPJyzaHDLNx9KoGq4RXBRNuBtuwugfGyuRy7gXevRlsjPCuHctO3522zxahMCSSaWKbbMEu84ZA== X-Received: by 2002:a17:906:6847:: with SMTP id a7mr9940202ejs.306.1593352638937; Sun, 28 Jun 2020 06:57:18 -0700 (PDT) Received: from powell.devork.be (2a02-8388-8480-1180-4c18-fc69-8d8c-22b5.cable.dynamic.v6.surfer.at. [2a02:8388:8480:1180:4c18:fc69:8d8c:22b5]) by smtp.gmail.com with ESMTPSA id y22sm12340994ejf.108.2020.06.28.06.57.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 06:57:18 -0700 (PDT) Received: (nullmailer pid 327593 invoked by uid 1000); Sun, 28 Jun 2020 13:57:17 -0000 From: Floris Bruynooghe To: notmuch@notmuchmail.org Subject: Usage after database close Date: Sun, 28 Jun 2020 15:57:17 +0200 Message-ID: <87d05je1j6.fsf@powell.devork.be> MIME-Version: 1.0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=gmail.com header.s=20161025 header.b=su3ANYXX; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: -0.01 X-TUID: dpi8qlpNMNkH Hi, I started writing some test cases to define better what you can do with a closed database and make sure that the python bindings do not behave unexpectedly here too. One of the first things I tried ends up with xapian calling exit_group(2) directly, terminating the process. So I'm wondering if I'm approaching this entirely the wrong way. My understanding is that we should generally be allowed to use anything after the database has been closed, as long as nothing has been destroyed. Below is a minimal reproducible example of what I'm testing so far. I must admit I'm generally lazy here and usually just test with notmuch that is currently in Debian testing. Cheers, Floris Here the script: #!/bin/sh MAILDIR=$(mktemp --directory) export MAILDIR echo $MAILDIR mkdir $MAILDIR/tmp mkdir $MAILDIR/new mkdir $MAILDIR/cur cat > $MAILDIR/notmuch-config < $MAILDIR/cur/1593342032.M818430P304029Q3.powell < Date: Sun, 28 Jun 2020 13:00:32 -0000 From: src@example.com To: dst@example.com Subject: Test mail Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 This is a test mail EOF notmuch new cat >$MAILDIR/test.c < #include int main(int argc, char** argv) { notmuch_status_t status; notmuch_database_t* db; notmuch_message_t* msg; const char* messageid; printf("Opening db\n"); status = notmuch_database_open(argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY, &db); if (status != NOTMUCH_STATUS_SUCCESS) { return status; } printf("Finding msg\n"); status = notmuch_database_find_message(db, "0@powell.devork.be", &msg); if (status != NOTMUCH_STATUS_SUCCESS) { return status; } printf("Closing db\n"); status = notmuch_database_close(db); if (status != NOTMUCH_STATUS_SUCCESS) { return status; } printf("Get messageid\n"); messageid = notmuch_message_get_message_id(msg); if (messageid == NULL) { return 1; } printf("Messageid: %s\n", messageid); printf("The end.\n"); } EOF gcc $MAILDIR/test.c -lnotmuch -o $MAILDIR/test $MAILDIR/test $MAILDIR