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

Fatal Exception: android.database.sqlite.SQLiteBlobTooBigException Row too big to fit into CursorWindow requiredPos=0, totalRows=1 #1862

Closed
mikezliu opened this issue Aug 2, 2020 · 4 comments
Labels

Comments

@mikezliu
Copy link

mikezliu commented Aug 2, 2020

Runtime Environment
SQLDelight version: 1.3.0, 1.4.0
Application OS: Android 9 OnePlus A3003

Describe the bug
This crash only seems to happen on OnePlus A3003 on Android 9. One of my users in production is getting this crash and it's 100% repro for him (can't use app anymore):

Fatal Exception: android.database.sqlite.SQLiteBlobTooBigException: Row too big to fit into CursorWindow requiredPos=0, totalRows=1
       at android.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow(SQLiteConnection.java)
       at android.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:859)
       at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:836)
       at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
       at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:149)
       at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:137)
       at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:220)
       at android.database.AbstractCursor.moveToNext(AbstractCursor.java:269)
       at com.squareup.sqldelight.android.AndroidCursor.next(AndroidCursor.java:248)
       at com.squareup.sqldelight.Query.executeAsOneOrNull(Query.java:160)

The query is looks like this:

SELECT *
FROM players
WHERE player_uid = :player_uid
LIMIT 1;

The players table does not have a blob column - just TEXT, INTEGER columns which have small data (player name, age)

@mikezliu mikezliu added the bug label Aug 2, 2020
@mikezliu
Copy link
Author

mikezliu commented Aug 3, 2020

I tried the following workaround but it didn't work for this particular device (Android 9 OnePlus A3003):

        fun setCursorSize() {
            try {
                val field: Field = CursorWindow::class.java.getDeclaredField("sCursorWindowSize")
                field.isAccessible = true
                val mb = 2
                field.set(null, mb * 1024 * 1024)
            } catch (e: Exception) {
                Timber.tag(TAG).e(e, "Cursor fix")
            }
        }

@mikezliu
Copy link
Author

Getting more reports of this issue - it seems to have started happening after upgrading to sqldelight 3.0.0

@AlecKazakova
Copy link
Collaborator

This is likely an OEM issue or an issue with the bundled sqlite wrapper. Nothing here points towards SQLDelight causing the issue

@wakaztahir
Copy link

I am getting this issue , I upgraded to sqldelight 2.0.0-alpha05 and started getting this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants