talloc_abort in notmuch_thread_get_tags () when db has been modified
authorGaute Hope <eg@gaute.vetsj.com>
Mon, 18 Jan 2016 08:46:41 +0000 (08:46 +0000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:20:53 +0000 (16:20 -0700)
60/ee60c25651f9a9ca63d09f8088e5364533fb90 [new file with mode: 0644]

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