react-native-async-storage / async-storage

An asynchronous, persistent, key-value storage system for React Native.
https://react-native-async-storage.github.io/async-storage/
MIT License
4.61k stars 458 forks source link

Unexpected AsyncStorage error: Row too big to fit into CursorWindow requiredPos=0, totalRows=1 #1110

Open biancabmagalhaes opened 5 days ago

biancabmagalhaes commented 5 days ago

What happened?

Production Error after use nextStorage

I have two types of logs one from crashlytics

Fatal Exception: android.database.CursorWindowAllocationException: Could not allocate CursorWindow '/data/user/0/com.app/databases/AsyncStorage' of size 104857600 due to error -12.
       at android.database.CursorWindow.nativeCreate(CursorWindow.java)
       at android.database.CursorWindow.<init>(CursorWindow.java:139)
       at android.database.CursorWindow.<init>(CursorWindow.java:120)
       at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:202)
       at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:147)
       at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:140)
       at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:232)
       at android.database.AbstractCursor.moveToNext(AbstractCursor.java:281)
       at androidx.room.InvalidationTracker$1.checkUpdatedTable(InvalidationTracker.java:463)
       at androidx.room.InvalidationTracker$1.run(InvalidationTracker.java:433)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:919)

and an exception from sentry

Error: Unexpected AsyncStorage error: Row too big to fit into CursorWindow requiredPos=0, totalRows=1

Looking throw past issues i found a work around we already did in MainApplication.java

try {
      Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize");
      field.setAccessible(true);
      field.set(null, 100 * 1024 * 1024); //100MB
    } catch (Exception e) {
      if (BuildConfig.DEBUG) {
        e.printStackTrace();
      }
    }

but i'm still facing this issue with various types of users most of them are with

Captura de Tela 2024-06-26 às 19 52 32 Captura de Tela 2024-06-26 às 19 53 08

Version

1.23.0

What platforms are you seeing this issue on?

System Information

System:
    OS: macOS 14.3
    CPU: (8) x64 Apple M2
    Memory: 49.78 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 14.5.0 - ~/.nvm/versions/node/v14.5.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v14.5.0/bin/yarn
    npm: 6.14.5 - ~/.nvm/versions/node/v14.5.0/bin/npm
    Watchman: 2024.03.18.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: Not Found
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 2023.1 AI-231.9392.1.2311.11255304
    Xcode: 15.2/15C500b - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.10 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0
    react-native: 0.68.3 => 0.68.3
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to Reproduce

We just use the app and it crashes, not a reproducible flow