Skip to content

Dbi not thread-safe when using comparators #127

@jheister

Description

@jheister

My assumption was that the Dbi object would be created once and then can be used from any thread (using relevant read/write transactions). I based this on the docs here:

Generally databases should only be opened once, by the first transaction in the process. After the first transaction completes, the database handles can freely be used by all subsequent transactions

If this is the case then there is a bug due to compKeyA and compKeyB being fields in Dbi and thus shared across users of Dbi. This code shows how a reader will lead to corrupt inserts of sequential keys when Dbi is shared. It feels like the reusable buffers should be coupled with the txn object, but I cannot see a good way of achieving this in the current form.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue relates to behaviour that violates the intention of the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions