From cc228bf196414cb9fcb3308b639da0089422cef0 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sun, 19 Feb 2012 00:56:56 +0100 Subject: [PATCH] Prevent segmentation fault in notmuch_database_close --- d7/5402c749d8db688f7f52068c52a606348de68d | 95 +++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 d7/5402c749d8db688f7f52068c52a606348de68d diff --git a/d7/5402c749d8db688f7f52068c52a606348de68d b/d7/5402c749d8db688f7f52068c52a606348de68d new file mode 100644 index 000000000..b3c7903b6 --- /dev/null +++ b/d7/5402c749d8db688f7f52068c52a606348de68d @@ -0,0 +1,95 @@ +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 DCD1D431FB6 + for ; Sat, 18 Feb 2012 15:57:15 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 h1HJLJTDZv+r for ; + Sat, 18 Feb 2012 15:57:15 -0800 (PST) +Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D46A2431FAE + for ; Sat, 18 Feb 2012 15:57:14 -0800 (PST) +Received: from mail.jade-hamburg.de (unknown [85.183.11.228]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.cryptobitch.de (Postfix) with ESMTPSA id D4C6652EF7F + for ; Sun, 19 Feb 2012 00:57:12 +0100 (CET) +Received: by mail.jade-hamburg.de (Postfix, from userid 401) + id 0D917DF2A4; Sun, 19 Feb 2012 00:57:12 +0100 (CET) +Received: from thinkbox.jade-hamburg.de + (dslb-092-078-042-203.pools.arcor-ip.net [92.78.42.203]) + (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) (Authenticated sender: teythoon) + by mail.jade-hamburg.de (Postfix) with ESMTPSA id B0606DF2A0 + for ; Sun, 19 Feb 2012 00:57:06 +0100 (CET) +Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77) + (envelope-from ) + id 1Ryu9I-0002GO-St + for notmuch@notmuchmail.org; Sun, 19 Feb 2012 00:57:04 +0100 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +To: notmuch@notmuchmail.org +Subject: Prevent segmentation fault in notmuch_database_close +Date: Sun, 19 Feb 2012 00:56:56 +0100 +Message-Id: + <1329609417-8391-1-git-send-email-4winter@informatik.uni-hamburg.de> +X-Mailer: git-send-email 1.7.9 +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: Sat, 18 Feb 2012 23:57:16 -0000 + +I've seen some segmentation faults lately again and rechecked the +python bindings and while I actually found and fixed some error +handling issues I overlooked last time, I think I also found a bug in +notmuch_database_close. + +The problem can easily be reproduced with the following program: + +~~~ snip ~~~ +import os +import time +import notmuch + +db_path = os.path.expanduser('~/Maildir') + +os.fork() +with notmuch.Database(db_path, mode=notmuch.Database.MODE.READ_WRITE) as db: + time.sleep(5) +~~~ snap ~~~ + +The top of the resulting stack trace is + +~~~ snip ~~~ +#0 0x00007fa2b6ac8104 in Xapian::WritableDatabase::commit() () + from /usr/lib/libxapian.so.22 +#1 0x00007fa2b7839de8 in Xapian::WritableDatabase::flush (this=0x0) + at /usr/include/xapian/database.h:579 +#2 0x00007fa2b78367aa in notmuch_database_close (notmuch=0x121ea70) + at lib/database.cc:722 +#3 0x00007fa2b7836749 in notmuch_database_open (path= + 0x7fa2b948ac94 "/home/teythoon/Maildir", + mode=NOTMUCH_DATABASE_MODE_READ_WRITE) at lib/database.cc:705 +~~~ snap ~~~ + +Cheers, +Justus + -- 2.26.2