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

reserved_space larger than allocated entry error in write heavy scenarios #321

Open
alexghr opened this issue Jan 6, 2025 · 2 comments
Open

Comments

@alexghr
Copy link

alexghr commented Jan 6, 2025

I'm seeing these errors reserved_space larger than allocated entry 2 15 507 0 2 2 pop up in write heavy scenarios where I'm using lmdb in a queue-like fashion. Eventually this leads to a crash in the process where it can't write to the underlying database anymore.

I have prepared this isolated test case that's exhibiting the same behaviour alexghr/reserved_space_error and I'd be interested if anyone has any insights into what I'm doing wrong here (or ideas to debug this further).

I have tested this both on Node 18.19 (old LTS) and 22.12 (current) on my PC running Linux.

One workaround I have found is to delete items one-by-one instead of batches of 100 items at a time (ie. use asyncPool(1, ...) on this line in test.mjs)

@kriszyp
Copy link
Owner

kriszyp commented Jan 14, 2025

Thank you for putting this together! However, I haven't been able to reproduce with this test case yet. Does this consistently reproduce with this test case? I have tried bumping up the run length and queues and still haven't seen the issue manifest (and I am actually running on linux/Ubuntu as well). And are there any other error messages or codes when it "leads to a crash in the process"?

@alexghr
Copy link
Author

alexghr commented Jan 16, 2025

Interestingly enough, I've restarted my computer yesterday and now running the test script I can't get it to print the errors even after increasing the batch size, max items and the frequency of writes.

I'm wondering if this might be due to a long running system? My development env is based on a long-running devcontainer so that's where I ran the script in. I've attached logs from before one of the crashes.

This was using lmdb-js 3.2.0

logs.json

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