unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Matthew Lear <matt@bubblegen.co.uk>, notmuch@notmuchmail.org
Subject: Re: Database locked when running hooks
Date: Thu, 18 Mar 2021 07:55:50 -0300	[thread overview]
Message-ID: <875z1o6895.fsf@tethera.net> (raw)
In-Reply-To: <9C1993DF-84BD-4199-A9C8-BADA98498812@bubblegen.co.uk>

Matthew Lear <matt@bubblegen.co.uk> 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 <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

  reply	other threads:[~2021-03-18 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18  8:32 Database locked when running hooks Matthew Lear
2021-03-18 10:55 ` David Bremner [this message]
2021-03-19  2:07 ` [PATCH 1/2] test: Add tests for write access to database from hooks David Bremner
2021-03-19  2:07   ` [PATCH 2/2] CLI/new: drop the write lock to run the pre-new hook David Bremner
2021-03-24 11:03     ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875z1o6895.fsf@tethera.net \
    --to=david@tethera.net \
    --cc=matt@bubblegen.co.uk \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).