Re: [Paul Wise] Bug#843127: notmuch: race condition in `notmuch new`?

Subject: Re: [Paul Wise] Bug#843127: notmuch: race condition in `notmuch new`?

Date: Fri, 04 Nov 2016 13:26:17 -0300

To: notmuch@notmuchmail.org

Cc: Paul Wise, 843127@bugs.debian.org

From: David Bremner


Paul Wise wrote:

> Last night I got this errorĀ from my `notmuch new --quiet` cron job. The
> file that the error message complains about is now in the cur directory
> of the maildir at the following path.
>
> /path/to/mail/cur/1478190211.H80553P18378.chianamo:2,
>
> I wonder if this some kind of race condition in `notmuch new` processing.
> Perhaps it should be using inotify to find out about file movements?
>
> Unexpected error with file /path/to/mail/new/1478190211.H80553P18378.chianamo
> add_file: Something went wrong trying to read or write a file
> Error opening /path/to/mail/new/1478190211.H80553P18378.chianamo: No such file or directory
> Note: A fatal error was encountered: Something went wrong trying to read or write a file

I agree it looks like a race condition. inotify sounds a bit
overcomplicated and perhaps non-portable? It should probably just
tolerate disappearing files better, consider that a warning.

As a workaround, if you can replace background use of notmuch-new with
notmuch-insert (and I understand this doesn't work for everyone), you
will eliminate this kind of race condition.

d

Thread: