Skip to content

Notmuch is (currently?) not thread safe #48

Description

@kevinboulain

FYI.

Quoting the readme:

So, as far as I am concerned, it is not thread safe. Hence, all pointers are internally tracked with Rcs.

Sadly, that's not enough and I'm not sure what's the best course of action for notmuch-rs (introducing locking in all functions seems a bit overkill) but I've asked on the mailing list (with an example fix) if Notmuch is supposed to be thread safe.

Here is a repro:

#[cfg(test)]
mod tests {
    fn setup() {
        let directory = tempfile::tempdir().unwrap();
        let database = notmuch::Database::create(directory.path()).unwrap();
    }
    #[test]
    fn thread1() {
        setup()
    }
    #[test]
    fn thread2() {
        setup()
    }
}
while cargo test; do :; done

Resulting in:

running 2 tests
error: test failed, to rerun pass `--bin repro`

Caused by:
  process didn't exit successfully: `.../repro/target/debug/deps/repro-fe1206eee7835a6c` (signal: 11, SIGSEGV: invalid memory reference)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions