unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Michael J Gruber <git@grubix.eu>
To: Alexander Adolf <alexander.adolf@condition-alpha.com>,
	David Bremner <david@tethera.net>,
	notmuch@notmuchmail.org
Subject: Re: Possible threading issues in nm 0.32
Date: Tue, 11 May 2021 18:56:08 +0200	[thread overview]
Message-ID: <162075216869.247978.11973039285204032566.git@grubix.eu> (raw)
In-Reply-To: <162074768557.189534.10699410442728726615.git@grubix.eu>

... just a guess: Could it be that 

a9f74aee ("CLI/new: drop the write lock to run the pre-new hook.", 2021-03-18)

was not enough?

notmuch_database_reopen() only reopens the xapian db but does not update
other members in notmuch_database_t *notmuch, such as the last doc id
and thread id.

If a pre-merge hook changes the database then values in that struct will
be out of date.

Before the config changes in nm 0.32, there was no such struct to begin
with. After that, notmuch holds the struct just to be able to run the
hook (from the proper dir).

So I would think that reopen()ing to MODE_READ_ONLY is not a problem.
But after the hook run, are full close() then open() to
MODE_READ_WRITE() is necessary so that the values in the struct are
correct (or change reopen() to do that).

Indeed, if you open in MODE_READ_ONLY and don't hold a write lock you
cannot trust any cached values such as those stored in the struct, can
you?

Michael

  reply	other threads:[~2021-05-11 16:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05  7:51 Possible threading issues in nm 0.32 Michael J Gruber
2021-05-05 12:29 ` David Bremner
2021-05-08 15:45   ` Michael J Gruber
2021-05-11 14:04     ` Alexander Adolf
2021-05-11 14:32       ` Alexander Adolf
2021-05-11 15:41         ` Michael J Gruber
2021-05-11 16:56           ` Michael J Gruber [this message]
2021-05-11 17:39             ` David Bremner
2021-05-11 17:42             ` [PATCH] lib/notmuch_database_reopen: reload some database metada David Bremner
2021-05-11 17:47               ` David Bremner
2021-05-11 20:17                 ` Michael J Gruber
2021-05-11 20:48                   ` [PATCH] test: change database from within pre-new hook Michael J Gruber
2021-05-11 22:34                     ` David Bremner
2021-05-12  7:23                       ` Michael J Gruber
2021-05-12 11:47                         ` David Bremner
2021-05-12 12:07                 ` [PATCH] lib/notmuch_database_reopen: reload some database metada David Bremner
2021-05-12 13:30                   ` Michael J Gruber
2021-05-16 11:11                     ` 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=162075216869.247978.11973039285204032566.git@grubix.eu \
    --to=git@grubix.eu \
    --cc=alexander.adolf@condition-alpha.com \
    --cc=david@tethera.net \
    --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).