I've been getting a few crashes due to this exception, but can't replicate it on any of my own devices/emulator.

The stacktrace from google play console

android.database.CursorWindowAllocationException:

at android.database.CursorWindow. (CursorWindow.java:108)

at android.database.AbstractWindowedCursor.clearOrCreateWindow (AbstractWindowedCursor.java:198)

at android.database.sqlite.SQLiteCursor.fillWindow (SQLiteCursor.java:138)

at android.database.sqlite.SQLiteCursor.getCount (SQLiteCursor.java:132)

at android.database.AbstractCursor.moveToPosition (AbstractCursor.java:220)

at android.database.AbstractCursor.moveToNext (AbstractCursor.java:269)

at rpuls.yatzysheets.DBController.getGameTime (DBController.kt:264)

at rpuls.yatzysheets.PreviousGames$onCreateView$1.invoke (PreviousGames.kt:78)

at rpuls.yatzysheets.PreviousGames$onCreateView$1.invoke (PreviousGames.kt:23)

at org.jetbrains.anko.support.v4.SupportKt.UI (Support.kt:62)

at rpuls.yatzysheets.PreviousGames.onCreateView (PreviousGames.kt:33)

at android.support.v4.app.Fragment.performCreateView (Fragment.java:2337)

at android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1419)

at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState (FragmentManager.java:1740)

at android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1809)

at android.support.v4.app.BackStackRecord.executeOps (BackStackRecord.java:799)

at android.support.v4.app.FragmentManagerImpl.executeOps (FragmentManager.java:2580)

at android.support.v4.app.FragmentManagerImpl.executeOpsTogether (FragmentManager.java:2367)

at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute (FragmentManager.java:2322)

at android.support.v4.app.FragmentManagerImpl.execPendingActions (FragmentManager.java:2229)

at android.support.v4.app.FragmentManagerImpl$1.run (FragmentManager.java:700)

at android.os.Handler.handleCallback (Handler.java:790)

at android.os.Handler.dispatchMessage (Handler.java:99)

at android.os.Looper.loop (Looper.java:164)

at android.app.ActivityThread.main (ActivityThread.java:6651)

at java.lang.reflect.Method.invoke (Native Method)

at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)

at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:810)

The function that is throwing it

fun getGameTime(gameId: Long): String{

val db = this.readableDatabase

val cursor = db.rawQuery("SELECT ${gameTable.timestamp} FROM ${gameTable.table} WHERE ${gameTable.id} = ${gameId}", null)

var result = ""

if(cursor.moveToNext()){

result = cursor.getString(cursor.getColumnIndex(gameTable.timestamp))

}

db.close()

return result

}

As I google CursorWindowAllocationException almost every result is something related to not closing the cursor, and out of memory causing the moveToNext() to throw the exception.

How ever, in the stacktrace that I got there is nothing about out of memory and I believe that my cursor would be closed since the readableDatabase database that it lived on is closed?

The devices where the error occured

Basically a modern phone with 2GB ram. It happened once in the past 60 days, but I have seen it few months back.

The app is approximately run on 40 devices each day, so that is 1 crash in 2400 runs - not much, but I would like to know why this is happening.

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐