From 9d4fa023dd70aeb46d1e306ce95ea5f2ac984756 Mon Sep 17 00:00:00 2001 From: Gaute Hope Date: Mon, 18 Jan 2016 08:46:41 +0000 Subject: [PATCH] talloc_abort in notmuch_thread_get_tags () when db has been modified --- 60/ee60c25651f9a9ca63d09f8088e5364533fb90 | 118 ++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 60/ee60c25651f9a9ca63d09f8088e5364533fb90 diff --git a/60/ee60c25651f9a9ca63d09f8088e5364533fb90 b/60/ee60c25651f9a9ca63d09f8088e5364533fb90 new file mode 100644 index 000000000..371267809 --- /dev/null +++ b/60/ee60c25651f9a9ca63d09f8088e5364533fb90 @@ -0,0 +1,118 @@ +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 7B4ED6DE0924 + for ; Mon, 18 Jan 2016 00:46:51 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.445 +X-Spam-Level: +X-Spam-Status: No, score=-0.445 tagged_above=-999 required=5 tests=[AWL=0.275, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, + RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] 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 g736N4HIx_VH for ; + Mon, 18 Jan 2016 00:46:48 -0800 (PST) +Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com + [209.85.215.41]) + by arlo.cworth.org (Postfix) with ESMTPS id 04FBE6DE005F + for ; Mon, 18 Jan 2016 00:46:47 -0800 (PST) +Received: by mail-lf0-f41.google.com with SMTP id c192so314998353lfe.2 + for ; Mon, 18 Jan 2016 00:46:47 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gaute-vetsj-com.20150623.gappssmtp.com; s=20150623; + h=date:from:subject:to:references:in-reply-to:user-agent:message-id + :mime-version:content-type:content-transfer-encoding; + bh=OcFjh7AHD99s3G7BdpwXnbc5ou2ejJHseypfflNsgAo=; + b=J6tm5KyJENzgmf6SGdgSbTiKr/vk9g0QuxKcyoFGnCGzpQe+3z+WIl5h/ZimgVwnGa + SaCb+0e0yHGiv/kIi+phfHPuZ9CHzHBCXGJy95h4i5S+l0qRCWwlt8KyB1NUDHrA5+m3 + 2MMADiqtkqifQXslMJz8p39XgSloddjeW4dDVOsv7j20xTgCx4dnHTHKVUsvgR7DLraY + hKjiPVoS4isEQU12EuVHjRHvoFZ4RzTrjQArhlO8ncyAorG0rWf8Igi0OTxMlwiH2rzf + GerRZ/jBz/tK/RV86alCZokimTQc/OOphfwbQDEqwwg3ze8ZT/wa8mb4zf2urUO+mENz + 1T8g== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:date:from:subject:to:references:in-reply-to + :user-agent:message-id:mime-version:content-type + :content-transfer-encoding; + bh=OcFjh7AHD99s3G7BdpwXnbc5ou2ejJHseypfflNsgAo=; + b=DT88AQEWathgLgqlMieeMyWoOjuJ9r4QfA0+G7VgKtdE4P0EDltUR5zoDlx1ZjMwuw + XDuYS9NIDV1GhOi3H9RQ00bL5/kZEPDIvSQSdZIxffcsfKcFLzrXNHaQEkedH6amRgp0 + Fnzgh7HydqOO+hbwBbIYSoRGeMy+7ewfPfpLo5TxA6fwdtYtLyx6dnQSGxAjzHElldHx + XU1Lq1/V8W7uLVl4lbxUTjW5luHGYi9s9su7dC66qsIFSsBJYE6z0wQIwKxBy7XhDLn/ + +I6/1My3X01oUVvcgFEpRoGW/YFKHs6koeL7CBFQAxgxkUF83HbxelWa074yvd/1+jE5 + he2g== +X-Gm-Message-State: ALoCoQmsv1N4oHLLINUMwbMp6vpofmcQ45swPi1LaoUajIlbtRD5R7L5cZuIWgxA5xcGQXSu6GkZWVhnOzA0ysiL3qZ3Ws2hSg== +X-Received: by 10.25.35.143 with SMTP id j137mr8023239lfj.36.1453106803298; + Mon, 18 Jan 2016 00:46:43 -0800 (PST) +Received: from localhost ([128.39.46.106]) + by smtp.gmail.com with ESMTPSA id zk9sm3053374lbb.3.2016.01.18.00.46.41 + for + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 18 Jan 2016 00:46:42 -0800 (PST) +Date: Mon, 18 Jan 2016 08:46:41 +0000 +From: Gaute Hope +Subject: talloc_abort in notmuch_thread_get_tags () when db has been modified +To: notmuch@notmuchmail.org +References: +In-Reply-To: +User-Agent: astroid/vv0.4-207-g3734e861 (https://github.com/gauteh/astroid) +Message-Id: <1453106256-astroid-0-0ubhau8qws-26019@strange> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8; format=flowed +Content-Transfer-Encoding: quoted-printable +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: Mon, 18 Jan 2016 08:46:51 -0000 + +Hi, + +a user of astroid [0] ran into a issue [1] (full trace at issue) where +reading a long query causes a talloc_abort in notmuch_thread_get_tags +(). 'notmuch new' is running at the same time, and most likely a thread +in the query has been modified since the query was done. Note that a +notmuch_thread_get_authors () call returns NULL without causing a full +crash. The code causing the crash is: + +``` + for (tags =3D notmuch_thread_get_tags (nm_thread); + notmuch_tags_valid (tags); + notmuch_tags_move_to_next (tags)) + { + tag =3D notmuch_tags_get (tags); // tag belongs to tags + } + + // or db.cc:508 in astroid/src. +``` + +while: + +``` + const char * auths =3D notmuch_thread_get_authors (nm_thread); +``` + +returns `NULL`, but does not crash. + +Is there a way for me to handle this from the application side? +Admittedly I do keep query objects around for a while +(astroid/src/thread_index.cc:141), but in this case the issue would +probably occur anyway since it simply takes a long time to read the +query. + +Regards, Gaute + +[0] https://github.com/gauteh/astroid +[1] https://github.com/gauteh/astroid/issues/64 += -- 2.26.2