-
Notifications
You must be signed in to change notification settings - Fork 473
AsyncStorage Couldn't read row 0, col 0 from CursorWindow #10
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
Workaround: async getSafeItem(key) {
return new Promise((resolve, reject) => {
if (!key) {
reject('Invalid key');
}
AsyncStorage.getItem(createKey(key)).then((value) => {
resolve(value);
}, () => {// Couldn't read row 0, col 0 from CursorWindow
resolve(null); // Force not to break
});
});
} Additional Information
|
@krizzu why API: AsyncStorage label was removed if it is related? |
@juliopiubello Because this whole module is about AS. Since everything is related I just remove redundant labels |
@juliopiubello were you able to solve it? I'm having the same issue |
According to this comment on SO, Repro steps by OP gives us a 4194304 length string. According to ECMAScript specification, each character takes 2 bytes of memory, so whole is something around 8.38 MB. This is way over the limit of Now, to work around this:
thanks. |
2MB seems to be correct. CursorWindow's default constructor just pulls the number from the internal configuration. @krizzu Would it make sense to have a warning here in dev mode to make people more aware of the limitation? |
@tido64 You mean like checking for string length before calling Native Module? We could do it, I can imagine those JSON strings parsed all the time :) |
If you need more help with this particular issue, please do let us know. |
#99 |

This issue was originally created by @JAStanton as facebook/react-native#12529.
Description
When reading values that are too large using AsyncStorage on Android I run into this error:
I wrote a large value with AsyncStorage and later tried to read it, but it crashed.
Reproduction
It looks like on iOS we write to disk when the value is above a threshold and on Android we write to sqllite always.
Solution
In order for me to fix this I'll need to re-write AsyncStorage to write to disk instead of writing to sql. https://github.com/mvayngrib/react-native-safe-async-storage <--- this guys has the right idea but his code is super old and broken.
Additional Information
The text was updated successfully, but these errors were encountered: