From f30af969711e0a8c89176e2d91ebfe85d32431f6 Mon Sep 17 00:00:00 2001 From: Ali Polatel Date: Wed, 25 Apr 2012 23:22:45 +0300 Subject: [PATCH] Re: [PATCH] ruby: make sure the database is closed --- 43/d45aa4d526c1e37ba4c24112aba5e69a745354 | 139 ++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 43/d45aa4d526c1e37ba4c24112aba5e69a745354 diff --git a/43/d45aa4d526c1e37ba4c24112aba5e69a745354 b/43/d45aa4d526c1e37ba4c24112aba5e69a745354 new file mode 100644 index 000000000..c1be4cb00 --- /dev/null +++ b/43/d45aa4d526c1e37ba4c24112aba5e69a745354 @@ -0,0 +1,139 @@ +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 E0CC3431FB6 + for ; Wed, 25 Apr 2012 13:23:08 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.699 +X-Spam-Level: +X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-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 9zb88ET1+eWn for ; + Wed, 25 Apr 2012 13:23:08 -0700 (PDT) +Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com + [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id E7C71431FAE + for ; Wed, 25 Apr 2012 13:23:07 -0700 (PDT) +Received: by bkcjk13 with SMTP id jk13so60902bkc.26 + for ; Wed, 25 Apr 2012 13:23:06 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=mime-version:sender:in-reply-to:references:from:date + :x-google-sender-auth:message-id:subject:to:cc:content-type + :content-transfer-encoding; + bh=Kyk3QG0106xKi6x3eoCKRSNAij6JjsibZO40sSoP9y8=; + b=xIba6HhckJyMwOOMvKOHVdThYTyquOGriY/9c00hneFbsQQ//3wdP4pqqxI5vrutlC + IWT5LcfDMP0C44F+rqvKdVggKozdYnCIIHGQqdH5vdBtqB6gYP/oK9lPBHEpkKLIpyQa + fb7ZNoDjSz6lI6lERs56jNqntKFvmeO/R+ep+kH0uzrFNu9Prg/L3YJdudGQiy7Yjr6e + n8VDFR/Hh4Aslx9M+GAslVa3SFns4u7BbfzwpIcu3SGnx/sbHDpVyMGndWCSQeJydLbC + Tuqn3CUtXc1KhzmoqJytfColsRqSWwduGIskluX0WVTJqSt/bEid+RoL5h2lCc7Q0+iz + qTHw== +Received: by 10.204.128.152 with SMTP id k24mr1227434bks.127.1335385386343; + Wed, 25 Apr 2012 13:23:06 -0700 (PDT) +MIME-Version: 1.0 +Sender: polatel@gmail.com +Received: by 10.204.123.73 with HTTP; Wed, 25 Apr 2012 13:22:45 -0700 (PDT) +In-Reply-To: + +References: <1335185032-13075-1-git-send-email-felipe.contreras@gmail.com> + + + + + + + <20120424011528.GA12459@mit.edu> + +From: Ali Polatel +Date: Wed, 25 Apr 2012 23:22:45 +0300 +X-Google-Sender-Auth: jelBXbfFdp37iBN03aPmVmsv9uw +Message-ID: + +Subject: Re: [PATCH] ruby: make sure the database is closed +To: Felipe Contreras +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Cc: notmuch@notmuchmail.org +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: Wed, 25 Apr 2012 20:23:09 -0000 + +2012/4/24 Felipe Contreras : +> On Tue, Apr 24, 2012 at 4:15 AM, Austin Clements wrote= +: +>> Quoth Felipe Contreras on Apr 24 at =A03:45 am: +>>> On Tue, Apr 24, 2012 at 2:46 AM, Ali Polatel wrote: +>>> > 2012/4/24 Felipe Contreras : +>>> +>>> >> Personally I don't see why an object, like say a query would remain +>>> >> working correctly after the database is gone, either by calling +>>> >> .close() directly, or just loosing the pointer to the original objec= +t. +>>> >> I don't think users would expect that, or, even if they somehow foun= +d +>>> >> it useful, that most likely would be very seldom, and hardly worth +>>> >> worrying about it. +>>> > +>>> > Working correctly is not expected but wouldn't it be more appropriate +>>> > to throw an exception rather than dumping core or printing on standar= +d error? +>>> +>>> Sure, if that was possible. +>>> +>>> > I wonder whether we can make both work somehow. +>>> > Maybe by using talloc explicitly and keeping reference pointers? +>>> > I don't know whether it's worth bothering. +>>> +>>> Maybe, I don't see how, that's just not how C works. Maybe talloc does +>>> have some way to figure out if a pointer has been freed, but I doubt +>>> that, and I can't find it by grepping through the API. +>>> +>>> Another option would be hook into talloc's destructor so we know when +>>> an object is freed and taint it, but then we would be overriding +>>> notmuch's destructor, and there's no way around that (unless we tap +>>> into talloc's internal structures). A way to workaround that would be +>>> to modify notmuch's API so that we can specify a destructor for +>>> notmuch objects, but that would be tedious, and I doubt a lof people +>>> beside us would benefit from that. +>> +>> I believe (though I might be wrong) that bindings could simply +>> maintain their own talloc references to C objects returned by +>> libnotmuch to prevent them from being freed until the wrapper object +>> is garbage collected. =A0This would require modifying all of the +>> library's _destroy functions to use talloc_find_parent_bytype and +>> talloc_unlink instead of simply calling talloc_free, but I don't think +>> this change would be particularly invasive and it certainly wouldn't +>> affect the library interface. +> +> That might work, but still, I don't see why this patch can't be applied. + +I don't have anything against applying this patch. +If this fix has a kind of urgency -and I doubt it does- please get +someone to push the patch. +Below is my confirmation to accept the consequences: +LGTM + +Otherwise, I'd rather we fix it properly most probably using the +method described in Austin's previous mail. + +> Cheers. +> +> -- +> Felipe Contreras + + -alip -- 2.26.2