Notmuch backend: impossible to have two "accounts" #52

Closed
opened 2020-05-07 13:07:11 +03:00 by palb91 · 6 comments

Hi!

I use the following setup: two mail accounts under the same directory and a single notmuch database to handle them both:

$ ls -AF $MAILDIR
home/  work/  .notmuch/

I'm currently using alot as notmuch-based mail client, where I can split the view following accounts, I tried aerc where I can do it as well (differents accounts with different queries).

I wanted to try meli too, it looks great, readable, easily configurable. However, I can't have two separated accounts using notmuch backend. Here is my configuration:

[account.home]
root_mailbx  = "$MAILDIR"
format       = "notmuch"
index_style  = "conversations"
identity     = "palb91@example.com"
display_name = "Palb91"

    [account.home.mailboxes]
    "INBOX"  = { query="tag:home AND tag:inbox",   subscribe = true }
    "Archive = { query="tag:home AND tag:archive", subscribe = true }
    # Few more queries here...

[account.work]
root_mailbx  = "$MAILDIR"
format       = "notmuch"
index_style  = "conversations"
identity     = "work@example.com"
display_name = "Palb91"

    [account.work.mailboxes]
    "INBOX"  = { query="tag:work AND tag:inbox",   subscribe = true }
    "Archive = { query="tag:work AND tag:archive", subscribe = true }
    ...

When running meli, nothing append. No error, no interface, only my command and a cursor that seems to wait for something. I can only cancel with <C-c>.

$ meli
^C

$ meli
^C

If I comment one account or another it works fine, but once I set two accounts, it breaks.

More information:

  • I installed aur/meli-git and also tried from the sources (both on version meli 0.5.1);
  • $ RUST_BACKTRACE=1 cargo run does not give more information (there is no error after all);
  • $ meli --test-config "$XDG_CONFIG_HOME"/meli/config.toml returns no output.
Hi! I use the following setup: two mail accounts under the same directory and a single `notmuch` database to handle them both: ```console $ ls -AF $MAILDIR home/ work/ .notmuch/ ``` I'm currently using `alot` as notmuch-based mail client, where I can split the view following accounts, I tried `aerc` where I can do it as well (differents accounts with different queries). I wanted to try `meli` too, it looks great, readable, easily configurable. However, I can't have two separated accounts using notmuch backend. Here is my configuration: ```toml [account.home] root_mailbx = "$MAILDIR" format = "notmuch" index_style = "conversations" identity = "palb91@example.com" display_name = "Palb91" [account.home.mailboxes] "INBOX" = { query="tag:home AND tag:inbox", subscribe = true } "Archive = { query="tag:home AND tag:archive", subscribe = true } # Few more queries here... [account.work] root_mailbx = "$MAILDIR" format = "notmuch" index_style = "conversations" identity = "work@example.com" display_name = "Palb91" [account.work.mailboxes] "INBOX" = { query="tag:work AND tag:inbox", subscribe = true } "Archive = { query="tag:work AND tag:archive", subscribe = true } ... ``` When running `meli`, nothing append. No error, no interface, only my command and a cursor that seems to wait for something. I can only cancel with `<C-c>`. ```console $ meli ^C $ meli ^C ``` If I comment one account or another it works fine, but once I set two accounts, it breaks. More information: - I installed `aur/meli-git` and also tried from the sources (both on version ``meli 0.5.1``); - ``$ RUST_BACKTRACE=1 cargo run`` does not give more information (there is no error after all); - ``$ meli --test-config "$XDG_CONFIG_HOME"/meli/config.toml`` returns no output.
Manos Pitsidianakis added the
bug
notmuch
labels 2020-05-07 16:25:03 +03:00

Hello, thank you so much for your bug report! It seems meli doesn't take notmuch locking into account. The obvious solution here is to not take a write lock when initializing an account and acquire locks only when needed instead of holding them.

I will try to push a fix asap.

Hello, thank you so much for your bug report! It seems meli doesn't take notmuch locking into account. The obvious solution here is to not take a write lock when initializing an account and acquire locks only when needed instead of holding them. I will try to push a fix asap.

It seems you know what's blocking here, nice!

It is not obvious to me. Just for my own culture, could you explain what is the blocking part?

I'm not an accomplished developer but I know Python and I'm slowly, quietly learning Rust (this is what brought me to project like meli).

It seems you know what's blocking here, nice! It is not obvious to me. Just for my own culture, could you explain what is the blocking part? I'm not an accomplished developer but I know Python and I'm slowly, quietly learning Rust (this is what brought me to project like meli).

could you explain what is the blocking part?

Sure. In this line the notmuch database is opened with a write lock. The lock is held for as long as meli runs. So when the second account gets initialized, it requests another write lock on the database and blocks. In retrospect it seems like a big overlook. I'm looking at what needs to be changed right now. The general approach will be to hold the lock for short lived durations.

> could you explain what is the blocking part? Sure. In [this line](https://git.meli.delivery/meli/meli/src/branch/master/melib/src/backends/notmuch.rs#L185) the notmuch database is opened with a write lock. The lock is held for as long as meli runs. So when the second account gets initialized, it requests another write lock on the database and blocks. In retrospect it seems like a big overlook. I'm looking at what needs to be changed right now. The general approach will be to hold the lock for short lived durations.

Ok, so as I understand, it is for the same reason that I can't run 2 meli instances in parallel (at least with notmuch settings).

Ok, so as I understand, it is for the same reason that I can't run 2 meli instances in parallel (at least with notmuch settings).

Ok, this should be fixed by 2230e5705d

Ok, so as I understand, it is for the same reason that I can't run 2 meli instances in parallel (at least with notmuch settings).

Yes, yes :) It should work now.

Ok, this should be fixed by 2230e5705d910990c919809d88dd194a700bb38d > Ok, so as I understand, it is for the same reason that I can't run 2 meli instances in parallel (at least with notmuch settings). Yes, yes :) It should work now.

I confirm!

So now I can continue digging into meli. Seems promizing to me :)

Thanks for your responsiveness and your explainations!

I confirm! So now I can continue digging into meli. Seems promizing to me :) Thanks for your responsiveness and your explainations!
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: meli/meli#52
There is no content yet.