-
Notifications
You must be signed in to change notification settings - Fork 479
Closed
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or requesthelp wanted
platform: AndroidThis is Android specificThis is Android specific

Description
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.
BaseError: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
at e (/node_modules/react-native/Libraries/Storage/AsyncStorage.js:423:22)
at None (/node_modules/react-native/Libraries/Storage/AsyncStorage.js:416:71)
at map ([native code])
at errors (/node_modules/react-native/Libraries/Storage/AsyncStorage.js:416:51)
at slicedToArray (/node_modules/react-native/Libraries/Storage/AsyncStorage.js:54:33)
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.
let x = 'x';
while (x.length <= 3194304) {
x = `${x}${x}`;
}
await AsyncStorage.setItem('@@GARBAGE@@', x); // works
const garbage = await AsyncStorage.getItem('@@GARBAGE@@'); // throws
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
- React Native version: 0.39.2
- Platform: Android
- Operating System: Samsung Galaxy S4
hopha95, jkk, romit07, rawrmaan, appli-intramuros and 1 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or requesthelp wanted
platform: AndroidThis is Android specificThis is Android specific
