From: Konrad Hinsen Date: Tue, 12 Jan 2016 09:41:57 +0000 (+0100) Subject: Crash with Python bindings X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=239430b356cc27626a330738d06fc68da95932b7;p=notmuch-archives.git Crash with Python bindings --- diff --git a/2d/54c94cdb74a996d820dda23c97fcb0422f1e89 b/2d/54c94cdb74a996d820dda23c97fcb0422f1e89 new file mode 100644 index 000000000..9ecf73568 --- /dev/null +++ b/2d/54c94cdb74a996d820dda23c97fcb0422f1e89 @@ -0,0 +1,103 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 0BED16DE176B + for ; Tue, 12 Jan 2016 01:49:21 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.719 +X-Spam-Level: +X-Spam-Status: No, score=-0.719 tagged_above=-999 required=5 tests=[AWL=0.101, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, + SPF_PASS=-0.001] autolearn=disabled +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 0EaMhNYaMws5 for ; + Tue, 12 Jan 2016 01:49:19 -0800 (PST) +Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com + [66.111.4.28]) + by arlo.cworth.org (Postfix) with ESMTPS id 28ABD6DE176A + for ; Tue, 12 Jan 2016 01:49:19 -0800 (PST) +Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) + by mailout.nyi.internal (Postfix) with ESMTP id 5F6AD210CA + for ; Tue, 12 Jan 2016 04:41:59 -0500 (EST) +Received: from frontend1 ([10.202.2.160]) + by compute5.internal (MEProxy); Tue, 12 Jan 2016 04:41:59 -0500 +DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h= + content-transfer-encoding:content-type:date:from:message-id + :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=V3h + f7Y+u8G5oRresdGvKzsjfQ58=; b=nJlGlJt7dAEiqxh4EZsOPG5emn2BIuDNV8j + tF6k4YlBmVM1hVbbcx4YD1ASPzUbwZMrc7MSTzYdhSkxMJDyPkzZnAX32/QZ/gwL + 4cGsx8zJYahEWA5M5mdZoUDjjaGPELsFozWXPDqsTGJtf9pYiqlkGxmp3GJ0xVJw + e334Ctus= +DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= + messagingengine.com; h=content-transfer-encoding:content-type + :date:from:message-id:mime-version:subject:to:x-sasl-enc + :x-sasl-enc; s=smtpout; bh=V3hf7Y+u8G5oRresdGvKzsjfQ58=; b=c2xnM + 4IdrMQdUHWRgR5Ed5nL2BN15q9eZU689OHR0ExDAdGg5oHbFxSF8TmNAHgCr2Iyr + R/ou1KXVkc/bjBCic4vlMQDaKwZjiFdP/gx6bu3x6zuRedpOipnsBtS4KpKjmssz + B4pjnSRIUbh+YsZgHtY196k9vThJqwxo3rkXTA= +X-Sasl-enc: EOS2e5eDzVUSrl0VMs0Q2VOn0n0oAwHI/QBfu8fg5psJ 1452591719 +Received: from Ordinateur-de-Catherine--Konrad.local + (mic92-2-82-67-216-6.fbx.proxad.net [82.67.216.6]) + by mail.messagingengine.com (Postfix) with ESMTPA id C6F2BC013FE; + Tue, 12 Jan 2016 04:41:58 -0500 (EST) +To: notmuch@notmuchmail.org +From: Konrad Hinsen +Subject: Crash with Python bindings +Message-ID: <5694CA65.8010400@fastmail.net> +Date: Tue, 12 Jan 2016 10:41:57 +0100 +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) + Gecko/20100101 Thunderbird/38.5.1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8; format=flowed +Content-Transfer-Encoding: 7bit +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Tue, 12 Jan 2016 09:49:21 -0000 + +Hi everyone, + +I have been writing quite a few Python scripts for notmuch before +running into a strange bug. Here is a minimal script producing it: + +-------------------------------------------------- +from notmuch import Query, Database + +def foo(bar): + pass + +db = Database() +q = Query(db, "*") +db.close() +-------------------------------------------------- + +Running this script (Python 3.5, MacOS X) yields: + +[1] 22478 abort pydev3 Temp/notmuch_test.py + +The crash actually happens *after* db.close(), when the Python +interpreter exists, and therefore I suspect that no data is lost, but I +hesitate to use scripts with that behavior in production use. + +The strange part is that what causes the crash is the presence of the +function foo(), even though it is never called. Remove foo and the +script runs fine. It is also necessary to create a Query object. The +combination of a function definition (any) and the creation of a Query +object yields the crash. This looks like a memory management issue, but +I didn't explore it any further. + +Cheers, + Konrad.