Skip to content
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

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

Open
1 of 5 tasks
biancabmagalhaes opened this issue Jun 26, 2024 · 5 comments
Labels
bug Something isn't working Stale

Comments

@biancabmagalhaes
Copy link

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?

  • Android
  • iOS
  • macOS
  • Windows
  • web

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

@biancabmagalhaes biancabmagalhaes added the bug Something isn't working label Jun 26, 2024
@wilsolutions
Copy link

Interesting, I have this "workaround" from some time ago and since I'm upgrading the main RN version along some other modules I thought about removing it but looks likes it is still an issue...

@ToonEeraerts
Copy link

ToonEeraerts commented Aug 7, 2024

Same problem here whenever the storage goes over 2,2MB. Is this a hard limit?
The app also fails to hydrate properly after a restart when this error pops up :(

@ToonEeraerts
Copy link

Same problem here whenever the storage goes over 2,2MB. Is this a hard limit? The app also fails to hydrate properly after a restart when this error pops up :(

I was saving my whole state in one entry which is described as a hard limit here: https://react-native-async-storage.github.io/async-storage/docs/limits

@jeffreybenabou
Copy link

You could also try to save data as chunks, and get data as chunks also, it help me to overcome this problem

Copy link

This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.

@github-actions github-actions bot added the Stale label Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

4 participants