Skip to content

BUG: Allocated a page that is still referenced #881

Closed
@akiradeveloper

Description

@akiradeveloper

I am using redb in my library and I see an error message below in my tests occasionally.

thread '<unnamed>' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/redb-2.1.4/src/tree_store/page_store/page_manager.rs:820:13:
Allocated a page that is still referenced! r0.6/0
thread 'ND45467>' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/redb-2.1.4/src/tree_store/page_store/page_manager.rs:749:39:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }

Regarding writes, there is no concurrent transaction: insertions are queued and batched in one transaction. However, a transaction normally mixes write to multiple tables. The actual code is below. Is this a valid usage?

        let tx = self.db.begin_write()?;
        {
            let mut tbl = tx.open_table(table_def(&head.space))?;
            tbl.insert(head.index, value::ser(head.inner))?;
            notifiers.push(head.notifier);
        }
        for e in tail {
            let mut tbl = tx.open_table(table_def(&e.space))?;
            tbl.insert(e.index, value::ser(e.inner))?;
            notifiers.push(e.notifier);
        }
        tx.commit()?;

Since there is no conflicting transactions, I can't believe such a naive error could happen. Do you know some existing issue that's close to my problem? FYI, I am using memory backend for tests.

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