Re: [PATCH 1/2] Add Google Inc. to AUTHORS as a contributor.
[notmuch-archives.git] / 15 / c10187874ae25090de6efa22efeec482244efa
1 Return-Path: <amdragon@mit.edu>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id ACCF2431FAF\r
6         for <notmuch@notmuchmail.org>; Thu,  1 Mar 2012 10:11:51 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id kLYa-Tvqif06 for <notmuch@notmuchmail.org>;\r
16         Thu,  1 Mar 2012 10:11:48 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU\r
18         [18.7.68.37])\r
19         by olra.theworths.org (Postfix) with ESMTP id 03FB9431FAE\r
20         for <notmuch@notmuchmail.org>; Thu,  1 Mar 2012 10:11:47 -0800 (PST)\r
21 X-AuditID: 12074425-b7f4a6d0000008e0-d3-4f4fbbe36361\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id D3.66.02272.3EBBF4F4; Thu,  1 Mar 2012 13:11:47 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q21IBhnl025827; \r
27         Thu, 1 Mar 2012 13:11:44 -0500\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q21IBf9R025475\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Thu, 1 Mar 2012 13:11:43 -0500 (EST)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1S3ATd-0001PR-JP; Thu, 01 Mar 2012 13:11:41 -0500\r
37 Date: Thu, 1 Mar 2012 13:11:41 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Justus Winter <4winter@informatik.uni-hamburg.de>\r
40 Subject: Re: [PATCH] Actually close the xapian database in\r
41         notmuch_database_close\r
42 Message-ID: <20120301181141.GA4797@mit.edu>\r
43 References:\r
44  <1330507157-22859-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
45         <1330507157-22859-2-git-send-email-4winter@informatik.uni-hamburg.de>\r
46         <20120229154833.GB772@mit.edu> <20120229211922.GQ24964@survex.com>\r
47         <20120229221754.GD772@mit.edu>\r
48         <20120301065930.5076.72748@thinkbox.jade-hamburg.de>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=us-ascii\r
51 Content-Disposition: inline\r
52 In-Reply-To: <20120301065930.5076.72748@thinkbox.jade-hamburg.de>\r
53 User-Agent: Mutt/1.5.21 (2010-09-15)\r
54 X-Brightmail-Tracker:\r
55  H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42IR4hRV1n2829/foPOGsMXs1h9MFtdvzmS2\r
56         uL/8PasDs8fE86fZPJ6tusXssW7nH/YA5igum5TUnMyy1CJ9uwSujKVTnrEXdIhU/F5+mamB\r
57         8Qd/FyMnh4SAicTys7PZIWwxiQv31rN1MXJxCAnsY5S4feIrC4SznlFi9vwHzBDOCSaJi2/n\r
58         sEM4Sxglrh7uZQbpZxFQkXjWOQHMZhPQkNi2fzkjiC0iYCqx4cEDsB3MApYSV2dMYwWxhQWC\r
59         JU5NPs0GYvMKaEscnn+XBcQWEtjBJLHvTSREXFDi5MwnLBC9WhI3/r1k6mLkALKlJZb/4wAJ\r
60         cwo4SrRumghWIgp0wpST29gmMArNQtI9C0n3LITuBYzMqxhlU3KrdHMTM3OKU5N1i5MT8/JS\r
61         i3Qt9HIzS/RSU0o3MYKCnd1FdQfjhENKhxgFOBiVeHi9Jvr7C7EmlhVX5h5ilORgUhLlrd8J\r
62         FOJLyk+pzEgszogvKs1JLT7EKMHBrCTCK9UPlONNSaysSi3Kh0lJc7AoifNqar3zExJITyxJ\r
63         zU5NLUgtgsnKcHAoSfAqAqNaSLAoNT21Ii0zpwQhzcTBCTKcB2i4GkgNb3FBYm5xZjpE/hSj\r
64         opQ4ryhIQgAkkVGaB9cLS0avGMWBXhHmNQap4gEmMrjuV0CDmYAGL77sBzK4JBEhJdXAePYu\r
65         w4O1ZvPVHy3xyfk3YY1jbhPPw/y7cetOOu2xe1nQt/CJXKWWrssHFz4Gdf/qNe5nGZ+qLVUM\r
66         tr6/h3t2UnHG89N3uZ4fme3+bc7ifz/LH50V3MKe8LLrofmDW3pq2+ViZ7//r+NmayMd7HPl\r
67         1ZUXOcE1FxtzAoUZVRwea1cZLlXYVLfzqxJLcUaioRZzUXEiAB8BTUAhAwAA\r
68 Cc: Olly Betts <olly@survex.com>, notmuch@notmuchmail.org\r
69 X-BeenThere: notmuch@notmuchmail.org\r
70 X-Mailman-Version: 2.1.13\r
71 Precedence: list\r
72 List-Id: "Use and development of the notmuch mail system."\r
73         <notmuch.notmuchmail.org>\r
74 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
76 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
77 List-Post: <mailto:notmuch@notmuchmail.org>\r
78 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
79 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
80         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
81 X-List-Received-Date: Thu, 01 Mar 2012 18:11:51 -0000\r
82 \r
83 Quoth Justus Winter on Mar 01 at  7:59 am:\r
84 > Quoting Austin Clements (2012-02-29 23:17:54)\r
85 > >Quoth Olly Betts on Feb 29 at  9:19 pm:\r
86 > >> On Wed, Feb 29, 2012 at 10:48:33AM -0500, Austin Clements wrote:\r
87 > >> > Quoth Justus Winter on Feb 29 at 10:19 am:\r
88 > >> > > Formerly the xapian database object was deleted and closed in its\r
89 > >> > > destructor once the object was garbage collected. Explicitly call\r
90 > >> > > close() so that the database and the associated lock is released\r
91 > >> > > immediately.\r
92 > >> > \r
93 > >> > Interesting.  Is this a bug in Xapian?  According to the docs,\r
94 > >> > ~Database is supposed to close the database (if there are no other\r
95 > >> > copies, which there shouldn't be), so this should be redundant with\r
96 > >> > the delete notmuch->xapian_db a few lines down, but your experience\r
97 > >> > obviously suggests that it isn't and I can't find the code path in\r
98 > >> > Xapian that would close it in the destructor.\r
99 > >> \r
100 > >> Most Xapian API classes (including Database and WritableDatabase) just\r
101 > >> hold a reference-counted pointer, and so it's the destructor of the\r
102 > >> reference-counted object which closes the database.  If "PIMPL" means\r
103 > >> anything to you, that's what we have here.\r
104 > >> \r
105 > >> Some other API classes objects (such as PostingIterator) internally hold\r
106 > >> a reference to the database they are using, so calling close()\r
107 > >> explicitly is useful if you don't want to have to worry about such\r
108 > >> objects still existing and holding onto references which keep the\r
109 > >> database open.\r
110 > >\r
111 > >Makes sense.  Justus, could you add a comment to your patch explaining\r
112 > >that we explicitly close the database because there may be other\r
113 > >objects with references to it that would keep it open?\r
114\r
115 > I thought I did, I'm not a native speaker though, so if you want to\r
116 > reword my message be my guest ;)\r
117 \r
118 Sorry, I meant a code comment.  Perhaps something like,\r
119 \r
120 /* Many Xapian objects (and thus notmuch objects) hold references to\r
121  * the database, so merely deleting the database may not suffice to\r
122  * close it.  Thus, we explicitly close it here. */\r
123 \r
124 > >Also, since close could throw an exception, it should get wrapped in a\r
125 > >try/catch like flush currently is.\r
126\r
127 > My interpretation of [0] was that Xapian::Database::close() does not\r
128 > throw any exceptions.\r
129 \r
130 Olly mentioned on IRC that it can throw an exception (because, for\r
131 example, close calls flush).\r
132 \r
133 > Cheers,\r
134 > Justus\r
135\r
136 > 0: http://xapian.org/docs/apidoc/html/classXapian_1_1Database.html#59f5f8b137723dcaaabdbdccbc0cf1eb\r