-
Notifications
You must be signed in to change notification settings - Fork 60
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
PANIC: could not remove_last(); bug! #1
Comments
Thank you for the report! I have been a bit out of touch with my codebase, so I probably cannot debug it in an instant, but I will take a look! |
The error you see when trying to run (open the database) is due to header corruption... probably due to the failed write. The original error is from 203 pub fn insert(&mut self, key: &CacheKey, elem: T) {
204 if self.list.count() >= self.cap {
205 if let Some(removed_key) = self.list.remove_last() {
206 assert!(self.map.remove(&removed_key).is_some());
207 } else {
208 panic!("could not remove_last(); bug!");
209 }
210 }
211
212 let lru_handle = self.list.insert(key.clone());
213 self.map.insert(key.clone(), (elem, lru_handle));
214 } There must be something wrong in the cache logic that it is both full, but the last element in the LRU list isn't present. The tests are supposed to cover this, but apparently don't :) Do you know if it's deterministically reproducible? |
interestingly, on my machine it crashes with a different error:
indicating that the table reader is trying to read more from a block than the 32768 bytes in one. This points to some corruption, which is usually very difficult to fix. We should probably focus on the original bug that caused the crashing. |
note that for the first numbers:
Both differences are just one flipped bit; both times in the third position of the byte. Possibly this originates from some corruption? I know both from experience and literature that LevelDB's design doesn't cope very well with corruption (after all, we already ignore blocks with bad checksum, and if the data layout is wrong we're just hopelessly lost at the moment). |
I'm actually wrong, the first time it's at the fourth position, then at the third. |
I also encountered the same issue as the author. Though only able to reproduce the
I might think of wrong operation ordering so the partial execution makes the state invalid. |
Thank you for the information! I will try to dive down into the code base again at some point, it's been some time :) |
Not sure how useful is this report, but anyway...
I was playing with example
write-a-lot
, adjusting size of the data and got this error:could not remove_last(); bug!
Now the application won't start. Fails with:
Current code:
Rust version:
rustc 1.41.0 (5e1a79984 2020-01-27)
DB state: https://send.firefox.com/download/7281446ca733dbcd/#lVmzPpIyJVg1JrmGt7hMCw
The text was updated successfully, but these errors were encountered: