Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Allocated a page that is still referenced #881

Open
akiradeveloper opened this issue Oct 24, 2024 · 1 comment
Open

BUG: Allocated a page that is still referenced #881

akiradeveloper opened this issue Oct 24, 2024 · 1 comment

Comments

@akiradeveloper
Copy link

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.

@cberner
Copy link
Owner

cberner commented Oct 25, 2024

Hmm, ya that looks like very normal usage. Do you have a simple way to reproduce it? If you have a minimal reproduction I can run, I can take a look at what's going on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants