-
Notifications
You must be signed in to change notification settings - Fork 476
Could not allocate CursorWindow '/data/user/0/xx/databases/AsyncStorage' of size 1073741824 due to error -12. #847
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
Comments
Hey @iBotPeaches , thanks for this details issue. First of all, if you're using Room ( Second, your issue seems to be around CursorWindow size, which by default is 1MB and cannot be changed by developers, unless using internal API, which is what you do. (If internal API changes or you obfuscate your code with R8/ProGuard, it's highly likely the code won't work and you would not know it, because you ignore the exception). I believe that the size in error message is passed in bytes, so it seems like you're trying to read more data than the buffer can consume (from the snipped I see you set 1024MB, while the cursor needs ~1073MB). What I can suggest to try to nail this down:
|
Thanks @krizzu. Proceeding on following:
EDIT - Added a comment to this - https://issuetracker.google.com/issues/170228126 |
I'll close this to keep tracker clean. We've decided to change to a filesystem based storage. We can't squash these final crashes if the issues appear to be all the way upstream at the AOSP/OEM flavor levels. |
Sounds reasonable, good luck 👍 |
Well reverted that filesystem based storage rather quickly. Turns out if the device OOMs during a write/change to FS based storage - it corrupts it. When we OOM kill the application with Room and AsyncStorage - the transaction is not committed fully so the datastore is not disrupted. So now looking into 2 paths.
|
Uh oh!
There was an error while loading. Please reload this page.
What happened?
What is odd about this is at time of this crash with some debugging our redux-persist store was only actually 16MB.
Version
1.17.3
What platforms are you seeing this issue on?
System Information
Steps to Reproduce
We are noticing a very small crash percent of roughly .09% of users crashing. What is odd about this is a long time ago (roughly a year) we bumped our cursor window size to 1gb. Since we couldn't really stand the alternative of hitting the 6MB limit and then corrupting and then deleting our entire store.
So we just moved everything to 1gb, as well as upgrading to Room (Next) and it worked great - solved all issues. A year later revisiting this for tech debt and noticing a very small crash percent that I cannot really follow since the actual size of the persisted data ranges from 1mb to 22mb so no where near 1gb.
(gradle.properties)
MainApplication
I believe error -12 is a cursor leak and Kotlin should auto-close things so unsure what could be causing this. Things I've tested:
So I am guessing that as we persist things and we do it quite heavily, we continue to leak memory. At some point once it passes 1gb - it never loads until the phone is rebooted or some GC occurs.
It we look at our total 138 events in the past year of this exact error I see device wise:
With Android versions:
The text was updated successfully, but these errors were encountered: