From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cHQQGsAxU2ChMgAA0tVLHw (envelope-from ) for ; Thu, 18 Mar 2021 10:56:00 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id qPm2FcAxU2DxBwAAbx9fmQ (envelope-from ) for ; Thu, 18 Mar 2021 10:56:00 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B94BE22B9A for ; Thu, 18 Mar 2021 11:55:58 +0100 (CET) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 9BB3626C4A; Thu, 18 Mar 2021 06:55:55 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 2EF6E26B40 for ; Thu, 18 Mar 2021 06:55:53 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 87B125FA96; Thu, 18 Mar 2021 06:55:51 -0400 (EDT) Received: (nullmailer pid 1191136 invoked by uid 1000); Thu, 18 Mar 2021 10:55:50 -0000 From: David Bremner To: Matthew Lear , notmuch@notmuchmail.org Subject: Re: Database locked when running hooks In-Reply-To: <9C1993DF-84BD-4199-A9C8-BADA98498812@bubblegen.co.uk> References: <9C1993DF-84BD-4199-A9C8-BADA98498812@bubblegen.co.uk> Date: Thu, 18 Mar 2021 07:55:50 -0300 Message-ID: <875z1o6895.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: PH6QBSK34XQYZDI7BMBROEQAAZV5K5RL X-Message-ID-Hash: PH6QBSK34XQYZDI7BMBROEQAAZV5K5RL X-MailFrom: david@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616064959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=it2CjdlI5XSlG5lOFXf5z0312DfsyrKLkK3tscMhEoI=; b=Do8+Tx4Rvn2xnV5qJShnKCWjldNA/vXou4xEnRE2lmKTfCMlEqjgNq/yv/o3DgTp/JH8KH rVRJuY5lMCEmgjTNWMZr667P3wsEeTwTXlodgpttOdia7sdPIhYlVTNL1puWS+dwUNBn+P FmUzVQxLKYPzodk4/SK5Nn93S3xBZ5ReQw+4hk2uZEDDyafQv/wmPxlGsVIDieRub5l04G cn91wk1xtxrTDEmkXZZx8Qj5XFgKdSbIqwadP9fMlNexhTwvooKZ++hA9IMWIPByVE3gv4 1g01V0Mjy5akPTTr5B2M3Gf8jt3XOGl+Ll1eiSn1P060X2KnWmIB2B0XRWbrkA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616064959; a=rsa-sha256; cv=none; b=emGSkIcQ+NY+uIqTE7gVLDDoJc9hCGm2w6Po/TY86iNJjK/Rx/5VeQZS3UP566q2L3qANQ c1S7fhDxDo0SE9VlWbwqfo1avnGwe19Xu7RHYOPqu/aPUrdeSgcxrmuPWo2in8rdxmm/4R 0JatXhTGhTiWvH1GIEuJfALTod2Ahd28OOUjDYAsRDf4BT84IW3ZuLnv79UXXIV9kru+U6 9gyTCzQfpP3GtUG00YBRSOdQHFAoGrdqKwEi4fWDfLsQ41E0yKb9LoF2iQxZQ6p8DZUvZZ oXz+FVGiLNd/jimXSN4KJs/eWqM7cslgd0fS/DSrssJs18BtyqpnmCvl+yDmFA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.06 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: B94BE22B9A X-Spam-Score: -2.06 X-Migadu-Scanner: scn0.migadu.com X-TUID: sYeDqrWGA6gN Matthew Lear writes: > > The problem can be reproduced by creating $DATABASEDIR/.notmuch/hooks/pre-new and having it perform a notmuch CLI command to write to the DB, such as apply a tag. > > I described the problem in https://github.com/gauteh/lieer/issues/195 > > Assuming the database should be able to be opened for writing in the context of the pre-new (and post-new) hooks, this seems like a bug. Yes, this is a bug I introduced recently, thanks for bringing that to my attention. It should be just the pre-new hook which is (incorrectly) run while the database is locked, the post-new should continue to work as before. It should be fairly easy to fix, I just need to initially open the database read only, then re-open it for read/write after running the hook. d