Re: [PATCH] Actually close the xapian database in notmuch_database_close
authorAustin Clements <amdragon@MIT.EDU>
Wed, 29 Feb 2012 15:48:33 +0000 (10:48 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:04 +0000 (09:45 -0800)
95/32ac9674d72c85d89814d287e0dcfd66c303fc [new file with mode: 0644]

diff --git a/95/32ac9674d72c85d89814d287e0dcfd66c303fc b/95/32ac9674d72c85d89814d287e0dcfd66c303fc
new file mode 100644 (file)
index 0000000..d14c542
--- /dev/null
@@ -0,0 +1,116 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 440F8431E64\r
+       for <notmuch@notmuchmail.org>; Wed, 29 Feb 2012 07:48:38 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 1e23ME085oqC for <notmuch@notmuchmail.org>;\r
+       Wed, 29 Feb 2012 07:48:37 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
+       [18.7.68.35])\r
+       by olra.theworths.org (Postfix) with ESMTP id 96A55429E25\r
+       for <notmuch@notmuchmail.org>; Wed, 29 Feb 2012 07:48:37 -0800 (PST)\r
+X-AuditID: 12074423-b7f9c6d0000008c3-13-4f4e48d4cb98\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 57.B3.02243.4D84E4F4; Wed, 29 Feb 2012 10:48:36 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q1TFmZ36012392; \r
+       Wed, 29 Feb 2012 10:48:35 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q1TFmXow002648\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Wed, 29 Feb 2012 10:48:35 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1S2llZ-000861-Nd; Wed, 29 Feb 2012 10:48:33 -0500\r
+Date: Wed, 29 Feb 2012 10:48:33 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Justus Winter <4winter@informatik.uni-hamburg.de>,\r
+       Olly Betts <olly@survex.com>\r
+Subject: Re: [PATCH] Actually close the xapian database in\r
+       notmuch_database_close\r
+Message-ID: <20120229154833.GB772@mit.edu>\r
+References:\r
+ <1330507157-22859-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
+       <1330507157-22859-2-git-send-email-4winter@informatik.uni-hamburg.de>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To:\r
+ <1330507157-22859-2-git-send-email-4winter@informatik.uni-hamburg.de>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42IR4hTV1r3i4edvcPeWoMXs1h9MFtdvzmS2\r
+       uL/8PasDs8fE86fZPJ6tusXssW7nH/YA5igum5TUnMyy1CJ9uwSujGszdrEVvOKsuDDzPlsD\r
+       4zP2LkZODgkBE4lj/9YxQ9hiEhfurWfrYuTiEBLYxyixcsExdghnA6NEw9zDTBDOSSaJfZ03\r
+       mSGcJYwS6xeeYwHpZxFQldhwbhmYzSagIbFt/3JGEFtEIEZiz8o3rCA2s4C0xLffzUwgtrBA\r
+       sMSpyafZQGxeAS2J63O2QG2YySjRf+YwC0RCUOLkzCcsEM1aEjf+vQQq4gAbtPwfB0iYUyBI\r
+       YvHV/WAlogIqElNObmObwCg0C0n3LCTdsxC6FzAyr2KUTcmt0s1NzMwpTk3WLU5OzMtLLdI1\r
+       08vNLNFLTSndxAgKd3YX5R2Mfw4qHWIU4GBU4uGV5Pf1F2JNLCuuzD3EKMnBpCTKe9Hdz1+I\r
+       Lyk/pTIjsTgjvqg0J7X4EKMEB7OSCO9bKaAcb0piZVVqUT5MSpqDRUmcV0PrnZ+QQHpiSWp2\r
+       ampBahFMVoaDQ0mC1w8Y10KCRanpqRVpmTklCGkmDk6Q4TxAw++DLOYtLkjMLc5Mh8ifYlSU\r
+       Euf1AWkWAElklObB9cLS0StGcaBXhHl/grTzAFMZXPcroMFMQIMDOL1BBpckIqSkGhi3Orkf\r
+       WvM5d4LKWi2eXevLYn+em1s1J3qGW4mse7XLAmOH4l+MagzMChy8Dy78Fl1gJrLu0v8jS79P\r
+       LdSUra67F7tf+ZFqYERpUfIFx5NVs1YxlD+svHrc4NY9id+Ch9obNzQnu37NNPsmMSHk7MlO\r
+       GQUxM6UvmZc+Ob0p/2+uoakltdQr/pASS3FGoqEWc1FxIgCy3e1aIgMAAA==\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 29 Feb 2012 15:48:38 -0000\r
+\r
+Quoth Justus Winter on Feb 29 at 10:19 am:\r
+> Formerly the xapian database object was deleted and closed in its\r
+> destructor once the object was garbage collected. Explicitly call\r
+> close() so that the database and the associated lock is released\r
+> immediately.\r
+\r
+Interesting.  Is this a bug in Xapian?  According to the docs,\r
+~Database is supposed to close the database (if there are no other\r
+copies, which there shouldn't be), so this should be redundant with\r
+the delete notmuch->xapian_db a few lines down, but your experience\r
+obviously suggests that it isn't and I can't find the code path in\r
+Xapian that would close it in the destructor.\r
+\r
+Olly?\r
+\r
+> Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>\r
+> ---\r
+>  lib/database.cc |    4 ++++\r
+>  1 files changed, 4 insertions(+), 0 deletions(-)\r
+> \r
+> diff --git a/lib/database.cc b/lib/database.cc\r
+> index 5efa85e..79cf375 100644\r
+> --- a/lib/database.cc\r
+> +++ b/lib/database.cc\r
+> @@ -726,6 +726,10 @@ notmuch_database_close (notmuch_database_t *notmuch)\r
+>      }\r
+>      }\r
+>  \r
+> +    if (notmuch->xapian_db != NULL) {\r
+> +    notmuch->xapian_db->close();\r
+> +    }\r
+> +\r
+>      delete notmuch->term_gen;\r
+>      delete notmuch->query_parser;\r
+>      delete notmuch->xapian_db;\r