【发布时间】:2018-01-24 13:17:25
【问题描述】:
我在我的应用程序中使用带有 RxJava2 版本 1.0.0 的 Room。以前我使用的是 Realm,一切都很好。现在,当我在 Room 上迁移时,我遇到了具有类似堆栈跟踪的随机罕见崩溃:
Fatal Exception: android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed.
at android.database.CursorWindow.<init>(CursorWindow.java:109)
at android.database.CursorWindow.<init>(CursorWindow.java:100)
at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
at android.database.sqlite.SQLiteCursor.clearOrCreateWindow(SQLiteCursor.java:301)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:139)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:133)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:197)
at android.database.AbstractCursor.moveToNext(AbstractCursor.java:245)
at android.arch.persistence.room.InvalidationTracker.run(InvalidationTracker.java:372)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
有时它甚至没有提到房间。我没有直接使用任何游标,仅通过 Room 和 3rd 方库(在迁移期间我没有更改)。
我检查了 Room 生成的代码,它似乎都正确关闭了游标。
关于发生了什么以及如何调试此崩溃有什么想法吗?
【问题讨论】:
-
我也设置了
StrictMode.setVmPolicy(newStrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().build());,并且在日志中没有看到任何异常。 -
我看到了同样的问题。你找到解决办法了吗?
标签: android sqlite rx-java2 android-room