-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
WithInMemory(true) panic: runtime error: index out of range [0] with length 0 #1234
Comments
Thanks for raising this @dpgarrick. This definitely looks like a bug to me. I'll look into it. |
@dpgarrick I've raised #1235 to fix this. The issue was that I had set a hard limit of 1 MB on the maximum size of value in in-memory mode. Your code was inserting value of size 2 MB and that's why badger crashed. I've changed the code so that the maximum size of value in in-memory mode will be math.MaxInt32 (around 2 GB). |
@jarifibrahim Great thanks, I wondered if it was something simple like that. 2GB should be more than enough but also nice to know I can just increase the options.ValueThreshold to address. |
@dpgarrick If you're running badger in in-memory mode, the value of Lines 309 to 312 in 617ed7c
|
@jarifibrahim Ahh right, thanks for the clarification. |
This commit increases the ValueThreshold for in-memory mode. The existing threshold was of 1 MB which means badger would crash if len(value) was greater than 1 MB. This commit sets the value threshold to MaxInt32 (around 2 GB). Badger transaction would return an error if badger is running in in-memory mode and length of value is greater than the value threshold. Fixes #1234
This commit increases the ValueThreshold for in-memory mode. The existing threshold was of 1 MB which means badger would crash if len(value) was greater than 1 MB. This commit sets the value threshold to MaxInt32 (around 2 GB). Badger transaction would return an error if badger is running in in-memory mode and length of value is greater than the value threshold. Fixes #1234 (cherry picked from commit 5b4c0a6)
This commit increases the ValueThreshold for in-memory mode. The existing threshold was of 1 MB which means badger would crash if len(value) was greater than 1 MB. This commit sets the value threshold to MaxInt32 (around 2 GB). Badger transaction would return an error if badger is running in in-memory mode and length of value is greater than the value threshold. Fixes dgraph-io/badger#1234
What version of Go are you using (
go version
)?What version of Badger are you using?
2.0.2
Does this issue reproduce with the latest master?
Yes
What are the hardware specifications of the machine (RAM, OS, Disk)?
Model Identifier: MacBookPro16,1
Processor Name: 6-Core Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 6
L2 Cache (per Core): 256 KB
L3 Cache: 12 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB
SSD drive
What did you do?
Trying to store a ~2MB protobuf message in a badgerdb instance. Running badgerdb in disk mode and storing to ./db runs perfectly but changing the db instance to disk-less using WithInMemory(true) fails.
Decreasing the data size also runs fine in memory.
I've made a sparse repo just with source code reproducing the problem here:
https://github.com/dpgarrick/badgerdb-inmem
Should be able to reproduce via
and just commenting/uncommenting the database instance lines to go from disk to disk-less.
Unsure if I am just overlooking something obvious (pretty new to golang and badgerdb) but if I take only the first 40,000 lines of the data file instead of all ~88000 lines it runs fine WithInMemory(true) and it always runs fine when using badgerdb in disk mode so it seems more like a bug to me.
What did you expect to see?
Disk-less mode to run identical to the disk mode.
What did you see instead?
The text was updated successfully, but these errors were encountered: